Solved

SwapDepth please help

Posted on 2007-12-04
8
309 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
  • 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
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 this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
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.

770 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