Link to home
Start Free TrialLog in
Avatar of surfjoe
surfjoe

asked on

Bring button to top on mouse over

I have a gallery style page of small thumbnail image buttons. When the user rolls over each button it needs to enlarge to twice the size and display over the thumbnail images allside of it. Whe the user rolls of the button it needs to return to the original size. I am currently enlarging the buttons on roll over by setting the size on the button over state (frame 2 and 3) of the button library file but cannot get the button to appear on top when the user rolls the mouse over.

I have tried this but I get an error
on (rollOver) {

      //Bring to Front Behavior
      mx.behaviors.DepthControl.bringToFront(this);
      //End Behavior

}

Thanks in advance
Avatar of Ramy_atef
Ramy_atef

actually you better use movie clips not buttons

and the easy code will be

on (rollOver) {

     myMC.swapDepths(1000)

}

Regards,
Ramy
Avatar of surfjoe

ASKER

If I add the code on the actions layer with an instance of myMC on the stage I get and error but if I add

on (rollOver) {

    swapDepths(1000);

}

to the movie clip it works.

Have do I reset the size when the mouse rolls out back to original size?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Ramy_atef
Ramy_atef

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Aneesh Chopra
Hi surfjoe,

just for your knowledge,
you code is not functional because..."mx.behaviors.DepthControl.bringToFront" does not work with Buttons,

it only support MovieClip...
if you use MovieClip instead of Button, you original code will work fine.

Rgds
Aneesh