1 Attachment(s)
Trouble using getDepth() when using dynamic instance names
I am using Flash (as2) to create an interface that allows the user to move, scale and change the stacking order of externally loaded assets (ie. images, swfs). My problem is that I can do this:
myimgdepth2 = this._parent._parent._parent.slidetemplate.templat e1.asset_container.image_1.getDepth();
but I can't do this:
path = "_parent._parent._parent.slidetemplate.template1.a sset_container.image_1";
myimgdepth=this[path].getDepth();
I need to be able to create this 'path' variable (as opposed to hard-coding it) because it will change based on user input...(ie. choice of template, etc). The above example is just the simplest way I could think of to test things.
Could it be a data-typing situation? Am I referencing things wrong?
I tried it 3 different ways (thinking that the 'this' in 'this[path].getDepth()' could be to blame), but still - everything is tracing out as undefined.
//path = "this._parent._parent._parent.slidetemplate.templa te1.asset_container.image_1";
//path = "_root.slidetemplate.template1.asset_container.ima ge_1";
path = "_parent._parent._parent.slidetemplate.template1.a sset_container.image_1";
I was wondering if anyone could see anything glaringly obvious that I'm missing - or just don't know about.
~ thanks! I appreciate the time it took you to even read this ;)Attachment 73821