This content has been marked as final. Show 19 replies
either "this" or "this._parent" depending on where you code is located and whether your button is a simple button or a movieclip button.
kglad - thanks for the reply.
It's a simple button. With your two suggestions I either got a blank screen or the two swfs overlapping. The button in question is on Splash. Here's the hierarchy of the site (took a level out since yesterday):
START (graphic background) - - - level0 (?)
Just to be sure I need to ask this...If START is level0 then; Splash, Eng-FAQ, Eng, Span-FAQ and Span are all level1?? And then topic_e1,e2,s1 & s2 are level2 ?? Is that so?
Is this level numbering changed if I put "this._lockroot = true;" on all the swfs except START?
TIA your coaching.
on C1's timeline place:
and attached to your button press handler place:
test your movie and press that button. paste the output panel results here.
if you want to unload _level2 and you're using unloadClip, use the number 2 as the target.
I'm sorry but I have to step back. There are so many things not happening the way I want using the code I provided earlier that I had to strip it down and start over. ( No more preloader, no more shared library.) Then, following your technique I found what I needed to use loadClip to get a new swf into level0.container which would replace whatever was there. Thus I never needed unloadClip at level0.container
Now I the unload issue returns at the "topic" level.
Background: The main GUI, at level0.container, has buttons to go back to the Home screen. It also has menus that bring in topic content on part of the stage. The menus are dynamic text areas in MCs inside an accordion component. In those menus I use the "bringInContent" function below to create "mcHolder" on half the stage and load it with any topic swf. It works perfectly - until the user wants to go back Home. Clicking the Home buttn brings up Home "behind" mcHolder and they both play at once.
The topic swf is inside mcHolder but the GUI with the menu and the Home btn is in _level0.container.
When I tried - trace("C1: "+this) on the timeline with the GUI; - I got - _level0.container
When I tried - trace("button: "+this); on the Home button, I got - _level0.container.btn_Home.
When I added these to the bringInContent function, I got - _level0.mcHolder
Makes perfect sense but I couldn't figure out how to use this information to unload mcHolder AND switch out swfs in container to load Home.
You can see some of the variations I tried below.
Please help. I can get Home onto the stage but how do I get mcHolder off.
kglad - the same result. Is "getNextHighestDepth" messing me up? Since I'm always changing the depth of the things loaded into mcHolder, would that matter?
What if I put everything on a specific level in the whole project? Would that help?
if _level0.mcHolder is at a non-removable depth then yes, that would prevent you from removing it (with removeMovieClip) from your stage. but it wouldn't prevent you from unloading its contents.
use trace(mclLoader+" "+_level0.mcHolder) to make sure both objects exist.
if they do exist and mclLoader.unloadClip(_level0.mcHolder) does not appear to be unloading whatever was loaded into mcHolder, you should check if you're being fooled: the contents are unloading but you're seeing something that makes you think it's not unloading.
However - Now I'm very, very confused.
I put a trace you suggested right above the code where mcHolder is written. See the result below
As far as being fooled, the swf in mcHolder plays an FLV. When I click the Home btn I can see and hear the audio and video is still playing.
that looks like 3 different trace statements, i assume, from 3 different locations. it doesn't appear any of them are within scope of mclLoader or they are executed before mclLoader is defined.
the first two must be executed before mcHolder is created, if you used _level0.mcHolder in your trace statement.
I did use 3 differnt trace statements but added a text string so I could tell which location was sending the trace. I hope this didn't void whatever was returned.
I re-did the same test and the results are below.
What does in mean that mclLoader and mcHolder are undefined in places where I can SEE them in the code?
for a variable that contains an absolute path, like (_level0.mcHolder) to return undefined, your trace() function must be executing when _level.mcHolder does not exist.
for a variable without a path (like mclLoader) to return undefined, it either doesn't exist, at all, or it exists but not within the scope of the trace() function.
so, just below the code where mcHolder is created, use:
and just below the code where mclLoader is created use:
Neither of these traces came back until I clicked on a text link in the menu to bring in a video. So the mc with the code below is in START, Splash had loaded and from there opened Span_GUI - where the menu in question lives.
What have I learned here? I appreciate your input but I dont know the significance of what I'm looking at. Clarification?
to use the trace() function, it doesn't matter what you have to do to get it to execute. but it does matter what the output is. what is the output of those two trace() statements?
Sorry - I thought I included that information in my post.
_level0 [object Object]
then, if you only use loadClip to load into mcHolder, the following will always unload what's been loaded:
and you should NOT see undefined whereever you use that code along with
Thanks for the follow thru on this. What term can I look under in the reference docs to learn more about this aspect of AS? I run into this issue often.
What does the response "_level0 [object Object]" mean?
many flash objects when traced do not reveal their instance name. they just reveal that they extend the object class. in your situation you're seeing the results of tracing the moviecliploader instance.
what's important, in your situation, is your finding your moviecliploader is defined or else you'd see undefined traced.
so, back to your original problem, the following should always work when executed after you use your moviecliploader to load something in mcHolder: