Solved

Flash 8 - Swap MovieClip Depths or Get Next Highest Depth

Posted on 2006-06-09
9
1,642 Views
Last Modified: 2008-01-09
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
0
Comment
Question by:mazar33
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 7

Expert Comment

by:muxxter
ID: 16874403
Try this:

import mx.managers.DepthManager;

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

Cheers
MuXx
0
 
LVL 7

Expert Comment

by:Ramy_atef
ID: 16874543
another way is to add this code on each of the buttons

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

Regards,
0
 

Expert Comment

by:ptanuri
ID: 16875642
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
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 34

Expert Comment

by:Aneesh Chopra
ID: 16875890
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
0
 

Author Comment

by:mazar33
ID: 16882643
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
0
 
LVL 34

Accepted Solution

by:
Aneesh Chopra earned 125 total points
ID: 16882778

"what if I wanted to have 2 other MC's that stay on top of all the 12 MC's I had on stage?"

then you should set the that 2 MC's depth around 500 and 600..

and swapDepths all lower movies to 300..

this way, all of twelve movieClips will remains below than two main MC's

If still not clear, I would suggestion that upload your sample FLA, i will do it for you

you can use www.yousendit.com to upload ur file..

1.
open www.yousendit.com, insert a dummy sender email, browse for file and click send

2.
copy/paste the uploaded file link here.

Rgds
Aneesh
0
 

Author Comment

by:mazar33
ID: 16882888
Thanks so much to everyone.

I've learned and then some.

-mike

0
 

Author Comment

by:mazar33
ID: 16886449
Aneesh-

I sent you a fla file to YouSendIt to your email address.
0
 
LVL 34

Expert Comment

by:Aneesh Chopra
ID: 16886859
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

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question