Solved

SwapDepth please help

Posted on 2007-12-04
8
312 Views
Last Modified: 2010-05-19
I have a map of the US. For each state I created a button. On the over state of each button I have a movieclip popup over the states. My problem is some of the states cover my movieclip on occasion. Some work are fine others are not (the whole Northeast!). I have tried this.swapDepth(1000) and a million other numbers but it hasn't worked. I have also tried the getHeighestDepth with nothing.

Currently I have my instance names the state abbreviations.

What would you guys recommend...I want someone to rollover a state and have some information popover it. All the information for each state are already in their own movieclips.
0
Comment
Question by:lowsky13
[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
  • 4
  • 3
8 Comments
 
LVL 14

Expert Comment

by:trigger-happy
ID: 20408923
The movieclip swapdepth function will only take another movieclip as its parameter. I'm not sure how you organized the movieclips in your flash so I won't really be able to give any kind of definite help. On the other hand, if you want to rework things a bit, then what you can do is just create the tips and place them on stage all at once but set their _visible property to false. The idea would be to just make them visible when they should be.

--trigger-happy
0
 

Expert Comment

by:webstudiointeractive
ID: 20411644
try selecting your movieclip and adding this code in the Actions window:

onClipEvent (enterFrame) {
      this.swapDepths(_root.getNextHighestDepth());
}

that's a messy solution, as it give your movieclip a new highest depth on every single frame. But it works.  The cleaner way to do it would be to set that movieclip's depth when you rollover your state.
ie:

on (rollOver) {
      _root.yourMovieClip.swapDepths(_root.getNextHighestDepth());
}
0
 

Expert Comment

by:webstudiointeractive
ID: 20411682
p.s - that first code snippet assumed your movieclip exists at the _root level....
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 3

Author Comment

by:lowsky13
ID: 20412195
webstudiointeractive...both didn't work. I'm assuming because my movieclips are not on the stage. My movieclips are in my library. When I rollover my buttons (a state on the map) I want my movieclip(in my library) to be brought to front.
0
 
LVL 3

Author Comment

by:lowsky13
ID: 20412280
well...I maybe wrong in my last post...I have the movieclip in my library but I also have it in my overstate of my button. I was questioning before if _root was the proper way to go. Any ideas?
0
 

Expert Comment

by:webstudiointeractive
ID: 20412374
would you like to post on a website, or email it to maadcat@hotmail.com?  if so could you please ensure it's a Flash 8 compatible file. .
0
 
LVL 3

Author Comment

by:lowsky13
ID: 20412628
You can download the .fla at:
Flash 8: bytecrunch.com/flash/alternativeMap8.fla
Flash CS3: bytecrunch.com/flash/alternativeMap.fla
0
 

Accepted Solution

by:
webstudiointeractive earned 125 total points
ID: 20416001
okay since your movieclip is within the button - you can't actually use the swapDepths() method on a button.  so, here's what you have to do.  I did the following with Louisiana (had to google what LA stood for!!  getting my own US geographical lesson here :) :

1. in your layers window - find your button called LA.  Right-click and choose Type > Movieclip.  This will change your button in to a movieclip with 4 frames.
2. Double-click on LA from the Library, and click frame one.  In the Actions window - put a stop(); command (pressing "Esc" then "s" then "t" is the keyboard shortcut for adding the "stop();" code).  This stops the movieclip automatically playing, as movieclip's do.
3. Go back to the root level (Scene 1), and select LA on the stage.  In it's properties, change its Instance behavior from Button to Movie clip.  And then, click add the following code on the LA movie clip:

onClipEvent (enterFrame) {
      this.onRollOver = function() {
            this.swapDepths(_root.getNextHighestDepth());
            this.gotoAndStop(2);
      };
      this.onRollOut = this.onReleaseOutside = function() {
            this.gotoAndStop(1);
      };
}

If you want to add some functionality for when the user clicks a state... add another piece of code like:

      this.onPress = function() {
            this.gotoAndStop(3);
            // do whatever else you need to do here
      };

the "onClipEvent (enterFrame)"  code makes that code fire off every single frame.  You can find more about the "onPress", "onRelease" ect. Events at http://livedocs.adobe.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00002436.html - scroll down to the Event Summary.  

Using Movie Clips instead of buttons is a recommended approach.

Note - you will have to repleat this for every state.  hope it helps!  
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
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…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

696 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