I written this code but its not working:
on (release) {
for (i = 1; i <= 5; i++)
{
var container:MovieClip = this.createEmptyMovieClip(container*, this.getNextHighestDepth());
var label:TextField = this.container*.createTextField(label*, 1, 0, 0, 300, 100);
this.container*.done* = true;
this.container*.label*.text = "TXT0";
this.container*.label*.selectable = false;
this.container*.label*.autoSize = true;
this.container*._x = 150;
if (i != 1)
{
this.container*.label*._y = this.container[i-1]._y + this.container[i-1]._height + 10;
}
this.container*.onRelease = function()
{
if (this.done*)
{
this.label*.text = "TXT2
TXT2";
this.done* = false;
}
else
{
this.label*.text = "TXT1";
this.done* = true;
}
this.label*._y = _parent.container[i-1]._y + _parent.container[i-1]._height + 10;
};
if (i == 1)
{
// no onEnterFrame for the first Textfield
continue;
}
this.container*.onEnterFrame = function()
{
this.label*._y = _parent.container[i-1]._y + _parent.container[i-1]._height + 10;
};
}
}
I want to dynamically create some textfields (5 in this example) and vertically place them next to each other ([COLOR=#ff0000]_y=_y+_height+10[/COLOR] in this example). I also want to add an **[COLOR=#ff0000]onRelease [/COLOR]*event for each of them which checks [COLOR=#ff0000]done[/COLOR] (default is true) to toggle change clicked text to another text and back, also in the same time rearrange all textfields if one of textfields height changed.
What I get when I compile my code is the first and second textfields are arranged as I want but the other 3 textfields placed on textfield2, and also **[COLOR=#ff0000]onRelease [/COLOR]**does not work!
NOTE:
I replaced[COLOR=#ff0000] [“container”+i.toString()][/COLOR] with [COLOR=#ff0000]container[/COLOR]* and same for [COLOR=#ff0000][FONT=arial]done[/FONT][/COLOR]* and *[COLOR=#ff0000][FONT=arial]label [/FONT][/COLOR]**for readability! [FONT=impact](I know the code will not work because of these replacements, but it can be read better in this mode)[/FONT] and also added some line breaks!