_root?

Can anyone give me a good explanation of what _root is for and when the appropriate times are to use it?

http://www.kirupa.com/developer/actionscript/tricks/root_parent_this.asp

…I need a less complicated description than that. I’m very new to action scripting. I’ve used _root before but i barely have any understanding of what i’m doing when i use it.:hat:

_root is a reference. It calls the main timeline of the movie. thats all you need to know. When you are targeting a movieclip that is on the main stage you would put:

_root.NAMEOFMOVIECLIP

That’s the answer i was looking for. I still need to do more projects so i can get a better understanding of _root though.

keep in mind… not only can you go all the way to the root and then work forward down a line of objects, but you can also step up the chain of objects from one to the one that contains it, to the one that contains that one, etc until you reach the _root. This is done with the _parent reference.

as simply put as possible. You have a movie clip called mc1 which contains on it’s timeline a movie clip called mc2 which contains on it’s timeline a movie clip called mc3.

If you are on the timeline of mc3 and you put in this
trace(_root.mc1._name);
the output window will return “mc1”
trace(_parent._name);
the output window will return “mc2”
trace(_parent._parent._name);
the output window will return “mc1”

a good understanding of _parent and _root is very necessary as you explore action script, but it’s a lot let complex than it seems at first.

oh and no you can’t write _root._root or _root._parent and have it mean anything to the comp. Only _parent works chained together in multiples like that.

once you understand those two, ask us about the “this” reference. :slight_smile:

I understand what you’re saying because i used to use root in flash 5 except it was different. And plus i didn’t use any hand coding like i do now. I just need to get some projects done that use “root” and “this”. That will be the best way for me to get a better understanding of _root, parent, and anything else of that nature.