-
MindGem Graphics Inc.
Newbie question
So I have a button on which I create an instance of a symbol,
I'd like to have a listener for the new symbol but I get a reference error because it compiles the listener before I get to create the instance.
What do I do?
button1.addEventListener(MouseEvent.CLICK, test);
function test(e:MouseEvent):void
{
var ball:Ball = new Ball();
addChild(ball);
}
ball.addEventListener(MouseEvent.CLICK, test2);
function test2(e:MouseEvent):void
{
trace("test");
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|