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
surfjoeAsked:
Who is Participating?
 
Ramy_atefCommented:
Excuse me .. do you mean (how do you reset the depth when the mouse rolls out ??)

if so ,

on (rollOver) {
      myDepth = getDepth();
      swapDepths(1000);
}
on (rollOut) {
      swapDepths(myDepth);
}

if that is not what you wanted , please give me more details

Regards,
Ramy
0
 
Ramy_atefCommented:
actually you better use movie clips not buttons

and the easy code will be

on (rollOver) {

     myMC.swapDepths(1000)

}

Regards,
Ramy
0
 
surfjoeAuthor Commented:
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
0
 
Aneesh ChopraCommented:
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
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.