Link to home
Start Free TrialLog in
Avatar of InterMountainMgmt
InterMountainMgmtFlag for United States of America

asked on

Using Flash Depth Manager Across Multiple Scenes

Hello All,

First time poster with a Flash/Actionscript question.

I have a Flash app which displays information as pop-ups on movie-clip mouse-overs.  It is a map with location dots - mouse over a dot, get info about that location - mouse out, the info disappears.

When I started this job and inherited this file, it was set up as buttons with empty Up frames, and the info graphic in the Over/Down frames.  The problem with this was the map dots had to be placed on a separate layer than the buttons so they would be hidden by the Over popup.  Otherwise, the popups appeared behind neighboring dots and couldn't be seen.  Also, as we added/removed locations, I was having to add a visible dot on one layer and an invisible button exactly over it on another layer.  

I resolved this by converting the buttons to movie clips with Rollover and Rollout actionscripts to pop up the info.  That allowed me to completely remove the layer of plain dots.  Each movie clip instance contains its own dot and simply changes frames within the clip to display the info.  Works great.  However, depending on which layer the clip was on, they were being hidden by neighboring movie clip dots.  

I got around this, I thought, by invoking the DepthManager class in the root timeline and using it to position the active clip to the top depth on mouseover and back to the bottom depth on mouseout.  But, because the file is set up in scenes allowing users to isolate regions (All, SouthCentral, MidWest, etc.) I still have one problem.  

If I mouseover a California dot in the All scene, I get its info.  Mouseout, it disappears.  Great.  Then change scenes to MidAtlantic, or Northeast, or anywhere besides West, and the California dot I moused over is still visible.  Each scene actually contains only the dots for its region, but something about the shuffling algorithm in the Depthmanager makes the dots from one scene visible in another once they have been invoked.  I need a way to clear the Depthmanager layers each time I move between scenes.  

I have searched high and low for info about this, but the Depthmanager doesn't seem to be thoroughly documented, and I am having a hard time finalizing this.

Am attaching the actionscript to invoke Depthmanager on the root timeline (on the root timeline within each scene - is identical, could this be problematic?) as a code snippet, along with a snippet from one of the movieclip instances.

I can provide the .FLA file zipped up if needed.  Just let me know how to post a link to it here.

Thanks in advance for any info.
---From Root---
import mx.managers.DepthManager;
 
mcFocus = function(n){
  this[n].setDepthTo(DepthManager.kTop);
}
 
mcUnFocus = function(n){
  this[n].setDepthTo(DepthManager.kBottom);
}
 
---From Movieclip---
on (rollOver) {
 	_root.mcFocus("MankatoCYclip");  // Bring clip instance to top via Depthmanager
	this.gotoAndStop("On");  // Go to internal frame with info displayed
}
on (rollOut) {
	this.gotoAndStop("Off");  // Go back to internal frame with info hidden
 	_root.mcUnFocus("MankatoCYclip");  // Send back to bottom via Depthmanager
}
on (release) {
	getURL("http://www.wherever.com","_blank");
}

Open in new window

Avatar of blue-genie
blue-genie
Flag of South Africa image

add a .txt extention to your fla and zip it - let's have a lookie look.
Avatar of InterMountainMgmt

ASKER

here's the source

IMM-FlashMap.zip
hey sorry i didn't get back.
i've downloaded the files now and had a fiddle, but no joy.
I've not worked with DepthManager myself, i use the good ol swapDepths.
I'm assuming (did some tests but can't 100% verify) - that because you've got instance with the same name, i.e. the files in All and then the other sections, there might be conflict.
would you be willing to change your file structure and take the items out of scenes?
i personally hate scenes and in my experience it often results in funny things happening.
blue-genie,
I'm not particularly attached to the scenes-structure.  That's just how I inherited the file, and I haven't had time to restructure it.  I'm not even sure I would know the easiest way to do so.  
I'm assuming it would involve linking region visibilities to the region-selection buttons across the bottom.  Whatever it is, I need it to provide an easy way to add new properties - not a lot of customized AS buried within clips within other clips.  Cutable-pastable AS where I can change just an instance name is preferable for time reasons.
Any suggestions or code hints for implementing visibility/functionality of the regions via the buttons rather than scene-changes would be highly appreciated.
Thanks - IMM.
ASKER CERTIFIED SOLUTION
Avatar of blue-genie
blue-genie
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
blue-genie, thanks for pointing me in the right direction.  I ended up placing my regional groups into regional movie-clips and putting them all in the first frame.  That allowed me to turn region visibility on/off involving the timeline.  I am still working on the DepthManager, but I have the worst of it worked out.