Solved

SwapDepth please help

Posted on 2007-12-04
8
308 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
To view Flash technology content error 4 6,472
anti-download video publishing site? 6 610
Running Mp4 or Flash Video 1 100
Actionscript in Flash 3 44
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
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 set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.

919 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now