View Full Version : Targeting issue?
Rolf
October 17th, 2003, 10:27 AM
Hi,
I'm getting confused. Can anyone explain something about _parent, _root and _levels?
I think i have a targeting problem.
On the stage is a movieclip called 'A'. 'A' is a scroller that scrolls another movieclip it contains, called 'B'. 'B' contains externally loaded text, which i load into 'B' with a frame action on the first frame of 'B':
loadVariablesNum("B.txt", 1);
When i test this, no text is loaded. What am i doing wrong here?
lac
October 17th, 2003, 01:17 PM
Hi Rolf,
I'll try to explain... at least how I understand that they work.
_root is the top level of the current movie clip, so if you only have one movie clip this is _level0.
If however you have a movie clip inside a movie clip then the _root of your movie A is _level0, but the _root of movie clip B is whatever level it has been loaded into in movie clip A.
If this is wrong, would one of the Flash gurus please correct me.
Now _parent of movie clip B in your situation is movie clip A and movie clip A's _parent is _level0... I think.
I hope that I've helped clear things up a bit.
Liz
Maizoon
October 17th, 2003, 01:29 PM
Heres a nice tutorial from another site that breaks it down and even tests your knowledge :)
http://www.actionscript.org/tutorials/beginner/paths/index.shtml
jeremy*
October 17th, 2003, 01:48 PM
Originally posted by lac
but the _root of movie clip B is whatever level it has been loaded into in movie clip A.
I think you are confusing _root with _parent here.
_root will always be the maintime line
same as level0.
lac
October 17th, 2003, 02:16 PM
Jeremy,
I created two movie clips in one mc and traced _root and you were correct they both came back with _level0 but what I was confusing it with is if you load an external swf file and call _root from that it displays the level that the swf was loaded into.
Liz
Rolf
October 17th, 2003, 03:29 PM
:h: Thank you all for replying. I tried all suggestions, but still no text loads.
I have attached a small testfile and .txt so you can see what i have done (wrong) if anyone feels the urge to have a look...
I would appreciate it very much.
jeremy*
October 17th, 2003, 04:01 PM
well I got it to load your content
I swtiched from LoadVariablesNum to
just LoadVariables.
The problem you were having was a targeting problem.
In your file you were incorrectly targeting the instance name. here is your code.
you were actually calling the symbol name, not the instance name. The instance name is the word below the "movieclip" pull down menu. Notice in your file that your "Content" movieclip also has an instance name of content.
loadVariablesNum("B.txt", "_root.ScrollBarClip.Content");
since your movieclip actually had an instance name of "mainclip" that was your problem.
loadVariables("B.txt", _root.mainclip.content);
you could also use the above code inside the clip where the two textboxes are located, which I think would be a little cleaner, that way you wouldn't have to worry about the "scope" of your movieclip instance names.
you would use
loadVariables("B.txt", this);
inside your "content" movie clip
Rolf
October 17th, 2003, 04:20 PM
Thank you Jeremy!
I understand it all better now.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.