A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: layering my buttons to the top level!

  1. #1
    Senior Member
    Join Date
    May 2000
    Posts
    814

    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

  2. #2
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    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. -

  3. #3
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    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.

  4. #4
    Senior Member
    Join Date
    May 2000
    Posts
    814
    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.displayisplayObject.

  5. #5
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    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);
    }

  6. #6
    Senior Member
    Join Date
    May 2000
    Posts
    814
    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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center