Skip to main content
Participant
August 1, 2013
Answered

bring button (and pop up) to front on roll over

  • August 1, 2013
  • 3 replies
  • 715 views

I am using button symbols to create pop ups on rollover (by sticking the pop up box in their rollover state)

However I need a way to bring the buttons to the front when I rollover them because the pop  up overlap the other buttons.

Irealise this question has been asked before but I’m very new to as3 and I’m having difficulty adapting the answers to my code.

I greatly appreciate any help

Ben

var buttons:Array = [btn1,btn2];

function moveFront(event:MouseEvent):void {

                // move to front code

}

for(var i:uint = 0; i<buttons.length; i++) {

                buttons.addEventListener(MouseEvent.ROLL_OVER, moveFront);

}

This topic is closed to new replies. Start a new post to keep the conversation going.
Correct answer kglad

:

var buttons:Array = [btn1,btn2];

function moveFront(event:MouseEvent):void {

              event.currentTarget.parent.addChild(event.currentTarget);

}

for(var i:uint = 0; i<buttons.length; i++) {

                buttons.addEventListener(MouseEvent.ROLL_OVER, moveFront);

}

3 replies

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
August 1, 2013

:

var buttons:Array = [btn1,btn2];

function moveFront(event:MouseEvent):void {

              event.currentTarget.parent.addChild(event.currentTarget);

}

for(var i:uint = 0; i<buttons.length; i++) {

                buttons.addEventListener(MouseEvent.ROLL_OVER, moveFront);

}

Participant
August 1, 2013

Thank you!

I was trying

this.parent.addChild(this);

kglad
Community Expert
Community Expert
August 1, 2013

you're welcome.