PDA

View Full Version : loadMovie() : "_root" problem


Nicool
10-11-2003, 09:53 PM
Hye,

Flash problem : I loadMovie() a *.swf using "_root" variable in its scripts... But on loading "_root" as changed to the main variable of the receiving movie and the *.swf included does not work right. How to?

1001 thanks

Nicool
10-22-2003, 04:14 PM
Nobody to help me?
Is "_root" a base layer declaration, a base scene declaration, something else?

Garma
10-23-2003, 09:08 AM
don't know your problem but _root is a base *scene* node. all your scenes are attached to this baby.You can see this in the "movie explorer" (advice: make extensive use of that one)

poe
10-23-2003, 07:52 PM
first things first. you have to understand that "_root" is a virtual path.

in flash you have levels. _level0 is "_root". always. (well, not anymore however we dont need to go into that)

if you then load a movie into a new level using loadMovieNum it sits on "_leveln" (where n is the level number you chose), so any reference to "_root", because it is a virtual path will still lock to "_level0"

ways to get round this are:

use "_level" references for everything. not the best answer
use a global namespace to store things in...this is only available in flashMX and above and involves setting an object to store data in...along the lines of

_global.dataStore = {};

then you can use it like anything else

dataStore.arrays = {}
dataStore.arrays.timerArray = [];

this again is not an ideal solution...because it is accessible anywhere, if the object becomes bloated with data, it will take up alot or memory.

the best solution is the simplest. use "_parent" to get to where you want to store the info for each level. so if you are 3 movieClips down in _level1, the "root" or _level 1 is found at "_parent._parent._parent".

that will allow you always to load one movie into another and it be interoperable with no recoding required

Nicool
10-24-2003, 08:11 AM
Thanks a lot... I'll study it :|

CGTalk Moderation
01-16-2006, 07:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.