Copy link to clipboard
Copied
I have several movieClips on my Stage that are numbered, I don't want to create these dynamically, just call their heights dynamically:
mcText_One1
mcText_One2
mcText_One3
mcText_One4
I want to use the height value of each in a loop.
Here's what I have working except for what is bold. Just need the right syntax to dynamically call the height of that movieClip:
//
var LeadingValue = -2;
var TextAllSameHeight = 28;
//
var TextHeight_One = TextAllSameHeight;
var LinesOfText_One = 4;
var TotalHeight_One = (TextHeight_One * LinesOfText_One) + (LeadingValue * (LinesOfText_One - 1));
var Text_One:Object = {};
for (var Text_One_Count:uint = 0; Text_One_Count < LinesOfText_One; Text_One_Count++)
{
if (Text_One_Count==0)
{
Text_One['TextOne_EndY_' + (Text_One_Count+1)] =((mcBottomBox.y-TotalHeight_One)/2);
Text_One['TextOne_StartY_' + (Text_One_Count+1)] =-(mcText_One(Text_One_Count+1).height);
}
else
{
Text_One['TextOne_EndY_' + (Text_One_Count+1)] = Text_One['TextOne_EndY_' + Text_One_Count] + TextHeight_One + LeadingValue;;
}
}
Copy link to clipboard
Copied
I figured it out:
-(this["mcText_One" + (Text_One_Count+1)].height);
Copy link to clipboard
Copied
Yes, that is better but you should convert the number to a String if you are adding it to a String...
this["mcText_One" + String(Text_One_Count+1)].height;
Find more inspiration, events, and resources on the new Adobe Community
Explore Now