Solved

how to target the original root from a loaded movie

Posted on 2006-11-13
3
185 Views
Last Modified: 2008-02-01
I've got a large project which I've had to disect into chunks.
I'm loading each swf in as a loaded movie with loadMovie("addprovider.swf", 1);
inside the addprovider.swf is a movie clip. At the end of this movie clips timeline I would like it to target the root of the holding original swf and get it to move on a frame to simultaneously unload the movie and load in the newt in the sequence.

ive tried
this._lockroot = true; on the first frame of the main swf with _root.gotoAndPlay(2); in the loaded movie but it isnt working,

the second frame of the main swf unloads the movie with
stop();
unloadMovie(1);
loadMovie("addclient.swf", 2);

I would be very grateful for any help!
0
Comment
Question by:sousflai
3 Comments
 
LVL 34

Expert Comment

by:Aneesh Chopra
ID: 17935353
if you use "this.lockroot=true" in any swf or in any movieClip, it means, that SWF or movieClip and all its child movieClips are refering it as "_root". "_root" has been locked for them, they can't go beyond that level.

1.
if you have not used "_lockroot=true" in child swfs, then you can simply access parent _root using "_root"

2.
but if you have used "_lockroot=true" in child swfs, then you can't acess parent "_root" directly..

wordaround in this scenario is, after child SWF loading you have to set a parent "_root" pointer inside child SWF.. for example:
------------
loadMovie("addclient.swf", 2);

//check for loading completion
this.onEnterFrame = function()
{
   if(_level2.getBytesTotal()==_level2.getBytesLoaded() && _level2._width>0){
     _level2.mainroot = this;
     delete this.onEnterFrame;
   }
}

----------------

now you can access parent "_root" inside child SWF using "_root.mainroot"

-Aneesh
0
 
LVL 5

Accepted Solution

by:
blockage1 earned 500 total points
ID: 17969550
Can't you simply target the original swf as  _level0? i.e.

_level0.gotoAndPlay(2);
0
 
LVL 12

Expert Comment

by:SamuelRostol
ID: 18179186
blockage1 is correct.

If you use _level0, you'll target the topmost level :)
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
The goal of the tutorial is to teach the user how to how to record live broadcast.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

760 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

20 Experts available now in Live!

Get 1:1 Help Now