This is a problem I thought I understood and was addressed in a previous thread (http://forums.adobe.com/thread/441458?tstart=0), but I have a new situation where the old solution isn't working.
I have 3 instances on a "nested" movie clip. Their instance names are: b1, b2, and b3. When I trace these movieclips from the main timeline, I get:
trace(b1); // result = _level0.slide_mc.newMC.b1
trace(b2); // result = _level0.slide_mc.newMC.b2
trace(b2); // result = _level0.slide_mc.newMC.b3
From the main timeline, I want to fade up these movieclips using tween, but I need to do this by building the instance name in a variable:
var myInstance:String = "slide_mc.newMC.b"+ instanceNumber //(instanceNumber is equal to 1, 2, or 3)
Now, I thought using the variable in this manner would work:
new Tween (this[myInstance], "_alpha", None.easeNone, 0, 100, .5, true);
...but it doesn't.
I've checked trying to use the actual movie clip instance:
new Tween (this.slide_mc.newMC.b1, "_alpha", None.easeNone, 0, 100, .5, true);
...and it works fine. What am I not getting here?
A string of instance names cannot be treated the same way. Each bracketed string is evaluated as an individual object/instance. So you would need to use...
new Tween (this.slide_mc.newMC["b" + instanceNumber], "_alpha", None.easeNone, 0, 100, .5, true);
An alternative would be to use...
var myInstance:Object = this.slide_mc.newMC.["b"+ instanceNumber];
new Tween (myInstance, "_alpha", None.easeNone, 0, 100, .5, true);
I get it now.. (I hope!)
Thanks so much.