PDA

View Full Version : _parent



Raydred
November 19th, 2002, 02:33 PM
Alrighty, im loading in movies into a main swf movie.

Now i have to use _parent, but for some reason what i want to do doesnt work..

ex:

this works..

_root.myMc.myVar = 5;


this doesnt.

_parent.myMc.myVar = 5;


Now the thing is ,and we all know this, when loaded into a movie, the _root wont work because it's looking at the _root of the main movie, and not the loaded movie, (thats where _parent comes in) but for some reason i see a limitation to this sytax, anyone care to help me? or am i just crazy?!

Thanks! =)

lostinbeta
November 19th, 2002, 05:23 PM
Well if both the code and the object are on the same timline, you need no _root or _parent.

Did you try removing it all and testing it?

sbeener
November 20th, 2002, 03:54 AM
_root will always refer to the base level in which a movie resides, so it depends how you load in your movies.

say you load B.swf into A.swf

if you load like this:

loadMovie("B.swf",myTarget);

then from B, _root.refers to A because everything is in _level0.

if you load like this:

loadMovieNum("B.swf",3);

then from B, _root will refer to B because B is in _level3.

to reference outside the level that a movie resides, you need to use an absolute level reference, ie. _level0.

lostinbeta
November 20th, 2002, 03:57 AM
Very good to know sbeener.... very good to know....


:::ponders why I didn't know that already... then slams head into wall:::