Hey, quick question about accessing movie clips on stage in AS3.
All i really want to do is be able to affect multiple movieclips at once with event listeners and greensock tweens.
The first snag I hit was that I couldn’t create references to movie clips using the old [] Associative array referencing method. Maybe I still can with AS3, but I couldn’t get it to work…
So I found another technique using getChildByName that returns a reference to a movie clips and allows me to store that reference in a variable.
However, the movie clip I’m trying to affect with an event listener resides inside of another movie clips, so to build the address (aka, root.mc1.m2.mc3) to the mc I want to get to is proving to be difficult. (I’m very new to AS3…)
I thought the trace(target1_mc.target2_mc.name); at the bottom of the following code would output the name of target2_mc but it doesn’t…
Any idea what I’ve done wrong?
Thanks!
var i:uint=0;
for (i=0; i < sidebarLength; i++) {
var target1_mc:MovieClip;
target1_mc = MovieClip(getChildByName("btn_0"+(i+1)+"_highlight"));
var target2_mc:MovieClip;
target2_mc = MovieClip(target1_mc.getChildByName("highlight_hotspot_mc"));
trace(target1_mc.name);
trace(target2_mc.name);
trace(target1_mc.target2_mc.name);
}