-
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 getDepth-forum-post-screenshot.jpg
-
I just took off the quotes (facepalm) and it's not undefined anymore...now I'm getting this...
depth using variable for instance name: -16384
depth old school style: 1000
...the plot thickens...
-
.
Hi,
Perhaps post your fla here to be looked at
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|