[quoted text, click to view] >> I'm loosing my mind.
>
> did you look where you last had it? its always in the last
> place you look anyway.
lol Crackin' me up, Jeckyl.
To jesus102984783093987 (I thought there were only 102984783093986
Jesuses): As Jeckyl mentioned, paths are pretty much straight forward.
Since you used brackets in your subject line, I'll make a guess that you're
confused about when to use brackets and when not to when referencing movie
clip instances and other objects.
Normal dot notation should be familiar enough to anyone who uses folders
on a hard drive. Mac, Unix, Linux, Windows, you name it ... files live in
folders, and folders can be stacked in folders, and eventually you hit
bottom. In Flash, the bottom is _root or a level number _level0, _level1,
etc. If you had a clip with the instance name clipA and another inside it
with the instance name clipB in the main timeline, your path might be
expressed ...
_root.clipA.clipB
If you had a third clip in the main timeline, clipC, its path might be
expressed ...
_root.clipC
Now, from clipC's point of view, clipB could be expressed like this ...
_parent.clipA.clipB
.... because _root is the parent of both clipC and clipA. Make sense? Of
course, from clipC's point of view, the first example we looked at ...
_root.clipA.clipB
.... makes equally valid sense. Having said that, it's a good idea to get
used to relative pathing (with _parent and this), because you might, for
example, load your current SWF into another ... at which point the
*container* SWF's main timeline becomes the _root (no longer so the main
timeline of the *contained* SWF). So don't depend on the _root reference
unless you absolutely know you can.
So where do the brackets come into play? Well, they're known as the
array access operator. When they're not used in arrays, they can be used to
make object paths with strings instead of actual paths. So, for instance
....
_root["clipA"].clipB
.... is the same as ...
_root.clipA.clipB
.... even though the center part is a string. For that matter, these are all
equivalent:
_root["clip" + "A"].clipB
_root["cl" + "ip" + "A"].clipB
var str = "clip";
_root[str + "A"].clipB
.... and so on.
And really, that's all there is to it. Use the array access operator if
you need to create a path dynamically; otherwise, you generally don't need
it.
David
stiller (at) quip (dot) net
"Luck is the residue of good design."