PDA

View Full Version : Transitions Between External SWFs - _root problem



Shrike
August 19th, 2006, 07:06 AM
I know that there are couple of similar threads regarding same tutorial and similar problems but noone explains what to do in such situation... so here it goes

I know that it isn't very hard to do but probably I'm just stupid...

Lets say I got everything like in that tutorial [ http://www.kirupa.com/developer/mx2004/transitions.htm ] except that my container is not on main timeline but in another movieClip that is placed on the main timeline [Scene1 - movieClip - container].
Now as I clik on my buttons [they are placed in that movieClip too] I can see the transitions [intro and outro] but I got THE SAME .swf loading over and over again [same as I stated in my variable at the beggining f.e: currMovie = "section1"; will load section1 over and over no matter what button will I click].

Please help me with this cause I tried using, _root, _parent, _global, this, in many different ways but I can't get it working...

I will be very gratefull for any help cause its the 3rd day I'm trying to fix it...

P.S. Please remember that the code that loads new .swf to the container is in .swf already loaded ! So do I have to change exactly this line ? f.e: _root.container.loadMovie(_root.currMovie+".swf"); [that is placed in external .swf's ]

martialb75
January 16th, 2008, 05:49 PM
I Have the same problem.
No one can help?

Voetsjoeba
January 16th, 2008, 06:34 PM
Do I have to change exactly this line ? f.e: _root.container.loadMovie(_root.currMovie+".swf"); [that is placed in external .swf's ]

Yes, that is the line you will have to change. Because your container is no longer on the main timeline, _root.container is no longer a valid path. From your situation I understand that you placed it inside another movieclip, which in turn is located on the main timeline. So let's say you gave the one on the main timeline (ie. the one that has the container in it) the instance name myMovie, then you need to change the line of code at the end of the external SWFs to:



_root.myMovie.container.loadMovie(_root.currMovie+".swf");

martialb75
January 17th, 2008, 05:57 AM
Merci for this answer. It works perfectly.
Can i insist and make things more complicated.
Now i add an other level.
So, my container is still not on the main timeline but in a movieclip (see answeer above) but now, when i click on one of my button (portfolio), my container loads a swf that includes other buttons and a portfoliocontainer so that i can have the same transition effect. (so that i have my main file loading an external file which is also loading an external file)
You can see the example here (it takes time to load) http://membres.lycos.fr/arden/ (http://membres.lycos.fr/arden/index.html) it loads the swf in the second level, but the transition effect (outro) is no more working.What do i need to change in the coding so that it can works?
Is that clear? source files here.http://membres.lycos.fr/arden/annekeportfolio.zip
Thanks to whom could help me (Voetsjoeba you are my last hope)

martialb75
January 17th, 2008, 06:08 AM
I am not sure it was very clear:
if you look at this link http://membres.lycos.fr/arden/index.html
You can see that when you click on contact and then about, you can see that the transition tutorial is working.
What is different from the tutorial is that my container is in a movieclip.
Now, when you click on portfolio, it also loads an external swf with the transition but this swf is more complicated that in the tutorial because it add an other level of complexity.
So that when i click on portfolio, it loads the portfolio.swf in the container (the container is not on the main timeline but in a movieclip) and in the portfolio section, when i click on the green color, it loads a green.swf in the porfoliocontainer.
My problem is that the loading of the swf is working but not the "outro".

Voetsjoeba
January 17th, 2008, 06:37 AM
For that you'd apply the same thing, but this time you need to use a different variable than _root.currMovie. If you use the same one, it'll conflict with the level of transitioning above it. For the sake of example, let's say you called it _root.currMovie. Technically, you can keep the same name for the container movieclip of the second level since it would be loaded inside the first-level container, but to make it clear which one is which, let's call it container2.

Also, in the external SWFs of the second level of transitions (the portfolio transitions), you'll again have to make sure the path to the second-level container is correct. Keeping in mind that the second-level container (container2) was loaded inside the first-level container (container), which in turn was located inside a movieclip on the main timeline (consistently with my previous post I'll call that myMovie), your movieclip hierarchy looks like this:


_root (main timeline)
-- myMovie
---- container (container for first level of transitioning)
------ container2 (container for second level of transitioning)
Thus, the code you'll need to place at the end of the second-level external SWFs is this:


_root.myMovie.container.container2.loadMovie(_root .currMovie2+".swf");

The code on the buttons would be the same as the code on the buttons for the first level of transitioning, except of course that you need to use _root.currMovie2 and container2 instead of _root.currMovie and container.

martialb75
January 17th, 2008, 06:54 AM
THANKS A LOT!!!!!
If there is any thing i can do for you tell me... I am so happy. One day that i try to find a solution. And it was so simple... Vraiment Merci, arigato.