Solved

SwapDepth please help

Posted on 2007-12-04
8
307 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
Comment Utility
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
Comment Utility
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
Comment Utility
p.s - that first code snippet assumed your movieclip exists at the _root level....
0
 
LVL 3

Author Comment

by:lowsky13
Comment Utility
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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 3

Author Comment

by:lowsky13
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Error 2032 in all the browser 6 2,796
need a player that can play .d and .i DVR files 9 1,441
video live streaming 1 110
File drag and drop 6 127
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…
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
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 use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

771 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

10 Experts available now in Live!

Get 1:1 Help Now