>> box.addEventListener(MouseEvent.CLICK,
clickHandler);
box.buttonMode = true;
function clickHandler(evt:Object):void {
trace("You just clicked me!");
}
I tried that and it didn't work, I had to place that code
either on frame
90
or later, when that object already appeared in my flash
movieclip...
<<
Right, you can't assign actions to non-existent objects. The
better way
would be to have a function on frame 1, that you pass a clip
reference to.
Something like this:
function addClick(clipRef:MovieClip):void
{
clipRef.addEventListener(MouseEvent.CLICK, clickHandler);
clipRef.buttonMode = true;
function clickHandler(evt:Object):void {
trace("You just clicked me!");
}
}
--
Dave -
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/