SwapDepth / Return to Original Position/ Animated Buttons
Hi,
I was hoping someone might be able to help me.
I am creating a interactive desk, where all the items do something on the desk (i.e. rollover a post-it note and it enlarges so its readable) etc.
I have approximently 15 items on my desk and have created each item in a button, where the "Over" state is a moveclip that animates it enlarging.
My problem is the depth function; I can't work out how to rollover something and when the animation begins bring it to the front and at the end of the animation send it back to its original position.
Anyone have any ideas? I would really appreciate any help.
This only works well if you change the button to a movieclip and only in Actionscript 2. But if not, It seems like you could create a new layer on the button and simply reuse the movie clip. But once again, Im not exactly sure what youre trying to do.
Ok I played around with this for a while. The attached file was the best I personally could come up with.
Depth in flash has given me a lot of problems. The only thing i could think to do was swap whatever clip I wanted in front with the forward most clip. This poses minor problems mainly with the middle clips but depending on what youre working with it may not be a big deal.
After much messing around and changing Actionscript I've managed to get something working the way I wanted it too, although it may not be the best way, its works fine for me.
What I did is create a button with "image1", this is a standard button with the below on the button actionscript:
on (rollOver) {
topDepth++;
_root.image1.swapDepths(topDepth);
_root.image1_mc.gotoAndPlay(2);
}
on (rollOut) {
_root.image1.swapDepths(topDepth);
_root.image1_mc.gotoAndPlay(9);
}
Then I had a movieclip, with frame 1 empty with "stop();". Frame 2-8 had the image enlarging then "stop();" at frame 8, frame 9-12 had the image fade away and then a "stop();".
So basically my button was a play button for a movieclip.
Hope that makes sense and it's probably not the best way to do it, but it works and after spending nearly a day on it, it will do.