FrozenHaddock Tutorials: Target Paths

Welcome to this tutorial on target paths. In this tutorial, I will be explaining what target paths are, and how to refer to differant levels of the stage.

When you are refering to something in actionscript, you can use the instance name. You can use the instance name on it's own if it's on the same level. If it's not, you will need to use one of the following.

If you want to refer to the main stage, the bottom level, you can use _root You can then move on to other movie clips. For example-

_root.movieclipname
_root.movieclipname.movieclip2name

etc.

Or, if you are writing script on a movie clip, to refer to the movie clip itself you can use this Again, you can move onto other movie clips from this.

this.insidemovieclipname
this.insidemovieclipname.insidemovieclip2name

etc.

Finally you can refer to the next level down using _parent You can also move onto other movie clips form here.

_parent.othermovieclipname
_parent.othermovieclipname.othermovieclip2name

etc.

It's probably easier to see this in a diagram.

target

This is the movie clip you are writing the script on. Parent is the next level up, so the movie clip your movie clip is in. And Root is the base stage, the movie clip with your movie clip inside is on the base stage.

Hope that helps, It sounds confusing, but it's not when you use it. Try it out!

 

Written by: Tazzydevil XIII
http://www.frozenhaddock.co.uk