|
-
layering my buttons to the top level!
On mouseover i'm trying to get my selected button to come to the top of the display list of buttons.
the code below is my latest effort which does not work.
PHP Code:
function mouseOverHandler (e:Event):void {
this.setChildIndex(e.target,this.numChildren - 1);
}
any idea where i go from here?
rat
-
Senior Member
replace with this:
swapChildren(Button(e.currentTarget),Button(getChi ldAt(numChildren-1)));
use Button for the Button component and MovieClip for MovieClip buttons
- The right of the People to create Flash movies shall not be infringed. -
-
You could try something like this:
Code:
function mouseOverHandler (e:Event):void {
DisplayObject(e.target).parent.addChild(e.target);
}
addChild has an interesting quirk in that it puts things at the top of the list of display children. Combine this with the fact that it also removes the thing from any other displayList it was already on, and you get the "move-to-top" behavior you're looking for.
-
I keep getting this error whatever i seem to do!!!!
1118: Implicit coercion of a value with static type Object to a possibly unrelated type flash.display isplayObject.
-
You may have to use the cast version again in the addChild call. I believe the thing you posted is a warning rather than an error.
Code:
function mouseOverHandler (e:Event):void {
var targ:DisplayObject = DisplayObject(e.target);
targ.parent.addChild(targ);
}
-
that has done the trick.
thank you
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
|