flash question
- Started
- Last post
- 8 Responses
- histwinsiste
i suck at actionscript and need a real quick piece of code that will do the following: bring a button to the front/top of the stage on rollover.
to be exact i have a bunch of buttons on the stage right next to eachother and currently on rollover they expand. however when they expand i want them to overlap the buttons on each side. so i need to make sure that the button being rolled over is arranged on the front of the stage... then when you rollover the one next to it that one becomes the front button.
does this make sens? thanks!
- CyBrainX0
makes sense, use the movieClipName_mc.swapDepths(othe... to do it.
- histwinsiste0
hmm dont know if that will work. there are about 8 buttons arranged in a grid
- Hello-Sexy0
you can use
getNextHighestDepth()
then subtract one
then use
getInstanceAtDepth()
to get the highest movie clip
than swap with the rolled over button...
- CyBrainX0
Use:
my_mc.swapDepth (depth:Number);and make depth = 10,000.
That way, it will be on top.
- Hello-Sexy0
i would still use the getInstanceAtDepth.... better coding practice. I know you really dont need to but, that way is a cleaner way to code. you never need to specify a depth...
granted, you probably wont have anything on 10,000 but why hard code it when you dont have to?
- histwinsiste0
good lookin
i should be all set
- cphunk0
create an array of your movieclip names
set their initial swapdepths to whatever you wan't them to be.
each time you roll over one - create a loop that shuffles the current position of the movieclip you rolled over in the array to the top of the array
reshuffle the swapdepths of your movieclips based on their array position