Current location: Hot Scripts Forums » General Web Coding » Flash & ActionScript » AS3 Event Listener for a seperate class


AS3 Event Listener for a seperate class

Reply
  #1 (permalink)  
Old 11-13-09, 11:04 AM
mjjwatson mjjwatson is offline
Newbie Coder
 
Join Date: Nov 2009
Posts: 26
Thanks: 2
Thanked 1 Time in 1 Post
AS3 Event Listener for a seperate class

Hi all. I want to put an event listener onto an item on the stage through a custom class, although I just can't get the linkage right!

Let's say I have a button, "redbutton" on the stage, and a custom class, blah.as, which includes...

Code:
stage.redbutton.addEventListener(MouseEvent.CLICK, redfunction);
function redfunction(event:MouseEvent):void{
trace("wow");
}
This doesn't link up. I am aware that I shouldn't be using the stage at all, I'm just trying to experiment to find out how linkage correctly works. Equally so, I'd like to work out how to set an EventListener onto a different custom class, let's say at redbutton.as.

Thanks in advance.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Reassign a variable, linked to a class, from within the same class Ryan75 PHP 2 04-28-09 12:30 AM
[SOLVED] Handle event listener zoliky JavaScript 3 06-02-08 02:44 PM
conceptual problem: abstract class, interface or class UnrealEd Everything Java 2 05-12-07 08:30 AM
I need to pass this class Please Help! Negative6 Everything Java 1 05-03-07 07:55 AM


All times are GMT -5. The time now is 01:42 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.