-
Help with swapDepths (AS2)
I am a Flash newbie and I am trying to create a Flash with a bunch of people layered on the screen and when you rollover the person, you see their name and a description. The problem is that because the people are layered, the names and descriptions were falling behind the other buttons on rollover, so I turned all of the buttons into MCs and then added the following AS to the buttons:
on (rollOver) {
this.swapDepths(1000);
}
This works great for bringing the button and the rollover text to the forefront, but now what I want is to have the person go back to the back on rollOut. I've tried experimenting with the AS and I can't figure out how to send them back on rollout. Any ideas?
-
Nevermind
I think I posted this too soon...I did this and it worked:
on (rollOut) {
this.swapDepths(-1000);
}
Just in case it can help anyone else!
-
Oops
Again, I replied too soon...they're still jumping all around...They seem to switch depths randomly, not just on rollover and rollout.
Can anyone help? Is there AS I should be using instead?
-
Put all of your characters depths into an array. Look up a formula to find the least value in an array. Use swap depth to make the MC 1 depth level lower than the lowest depth level detected in the array.
Also, you could just use the code:
on (rollOver) {
this.swapDepths(_root.getNextHighestDepth());
}
-
Thank you
That is helpful for the rollover portion, but what would I do for rollout so that the person goes back when you're no longer hovering over them with the mouse?
-
Put all of your characters depths into an array. Look up a formula to find the least value in an array. Use swap depth to make the MC 1 depth level lower than the lowest depth level detected in the array.
And put it all under an on (rollOut) function.
-
Thanks
I wish I knew how to do what you are talking about! Since I am such a noob, can you point me to any tutorials on setting up arrays with swapDepths or give me a bit more detail on how to do that?
Thanks SO MUCH again!
-
Are you writing the code within a movie clip, or on the main timeline? Before you can easily use array to contain variables, all the code must be on the main timeline. It would be helpful to see the .fla.
Either way, I'll make a .swf file to show you how arrays work.
I'll edit this post when I'm finished with it.
-
FLA file
Adam - Thanks again for all your help! I can email you the FLA, but I can't post it on here because it has proprietary information and photos of people who signed very specific releases for how they're photos are to be distributed. Can you send me your email address?
Thanks again!
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|