Link to home
Start Free TrialLog in
Avatar of mazar33
mazar33

asked on

Flash 8 - Swap MovieClip Depths or Get Next Highest Depth

I have 12 MC's on the same layer of the main timeline of a flash movie. Each MC has a button inside it, that when clicked, tells that MC to play.

What I would like to do is that when that button is clicked, to have that MC brought to the front of the other 11 MC's. I'm not sure if it matters or not, but I have unique names for each MC.

I have read macromedia's help docs, but am a designer rather than AS expert. Help would be appreciated.

-mike
Avatar of muxxter
muxxter

Try this:

import mx.managers.DepthManager;

my_btn.onRelease = function() {
    my_mc.setDepthTo(DepthManager.kTop);
}

Cheers
MuXx
another way is to add this code on each of the buttons

on(release){
   this.swapDepths(100)
}

Regards,
you can use the Depath Manager.

at your root, add this code

import mx.managers.DepthManager

mcFocus = function(n){
  this[n].setDepthTo(DepthManager.kTop);
}


and at your MC, or any where inside your MC, you can simply call the function like this
on(release)// or on(press)
{
  _root.mcFocus("MCname"); // MCname is the name of movieclip you want to switch to top.
}

have a nice day..
p
Avatar of Aneesh Chopra
Hi,
Here I have uploaded a working sample for you
download it here:
http://www.yousendit.com/transfer.php?action=download&ufid=C48AA8173015780B


it should how you can control depths with mulitple movieClps

Rgds
Aneesh
Avatar of mazar33

ASKER

Aneesh, Thank you so much, I understand much better, It's kind of working, but it seems to be duplicating each MC.

I tried the DepthManager solutions as well, but I also get a duplicating of on or two of the MCs. And I looked this up elsewhere, and know that I don't have any other 2.0 components in this movie, so I'm thoroughly confused.

And not to add too much to the problem I'm still having, but what if I wanted to have 2 other MC's that stay on top of all the 12 MC's I had on stage?

-mike
ASKER CERTIFIED SOLUTION
Avatar of Aneesh Chopra
Aneesh Chopra
Flag of India image

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 mazar33

ASKER

Thanks so much to everyone.

I've learned and then some.

-mike

Avatar of mazar33

ASKER

Aneesh-

I sent you a fla file to YouSendIt to your email address.
Ok,
your scenario is completely different,

I have fixed the first four items for you,
you can use similar approach for all other items

download the update here:
http://www.yousendit.com/transfer.php?action=download&ufid=F8B4EF0A5A133987

main problem were in ur code was, you were using "setDepth", there is not such function in flash...
you should use "swapDepths()"

Rgds
Aneesh