Dynamic height rescale (based on string.length)

Hi there…

Okay what I after is how to detect the length of the string populated from array…then auto rescale the height of the title_mc as shown in my AS as well as the dynamic created textfield …so the textfield will display long string + “newline” for long string…(autowrapper)…

eg:

// for short text keep remain the standard size of height
mc.title_mc.tf.text = “short text”;

//for long string it will expandable the title_mc.height as well…dynamically
mc.title_mc.tf.text = “standard width title_mc”+newline;
//by the time string move to newline the title_mc.height also will increase

so how to determines the long string and auto rescale the title_mc.height

here’s the code currently I’m using…


     [LEFT][COLOR=#0000ff]stop[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];

[COLOR=#000000]**var**[/COLOR] sometesttext:[COLOR=#0000ff]Array[/COLOR] = [COLOR=#000000]**new**[/COLOR] [COLOR=#0000ff]Array[/COLOR][COLOR=#000000]([/COLOR][COLOR=#ff0000]"super super super longggggggg textttttttt iiiiiiiii guesssssssssss"[/COLOR],[COLOR=#ff0000]"intermediate text"[/COLOR],[COLOR=#ff0000]"short text"[/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#000000]**var**[/COLOR] len:[COLOR=#0000ff]Number[/COLOR] = sometesttext.[COLOR=#0000ff]length[/COLOR];

[COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]createEmptyMovieClip[/COLOR][COLOR=#000000]([/COLOR][COLOR=#ff0000]"mc"[/COLOR],[COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]getNextHighestDepth[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000])[/COLOR];

[COLOR=#0000ff]for[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000]**var**[/COLOR] i=[COLOR=#000080]0[/COLOR];i<len;i++[COLOR=#000000])[/COLOR][COLOR=#000000]{[/COLOR]
    [COLOR=#000000]**var**[/COLOR] mc = mc.[COLOR=#0000ff]attachMovie[/COLOR][COLOR=#000000]([/COLOR][COLOR=#ff0000]"bubbles"[/COLOR],[COLOR=#ff0000]"bubbles"[/COLOR]+i,mc.[COLOR=#0000ff]getNextHighestDepth[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000])[/COLOR];
    mc.[COLOR=#0000ff]_y[/COLOR] = [COLOR=#000080]50[/COLOR];
    mc.[COLOR=#0000ff]_x[/COLOR] = [COLOR=#000080]20[/COLOR]+mc.[COLOR=#0000ff]_width[/COLOR]*i;
    mc.[COLOR=#000080]ivar[/COLOR] = i;
    mc.[COLOR=#000080]title_mc[/COLOR].[COLOR=#0000ff]createTextField[/COLOR][COLOR=#000000]([/COLOR][COLOR=#ff0000]"tf"[/COLOR],[COLOR=#000080]100[/COLOR],mc.[COLOR=#000080]title_mc[/COLOR].[COLOR=#0000ff]_x[/COLOR],mc.[COLOR=#000080]title_mc[/COLOR].[COLOR=#0000ff]_y[/COLOR],mc.[COLOR=#000080]title_mc[/COLOR].[COLOR=#0000ff]_width[/COLOR],mc.[COLOR=#000080]title_mc[/COLOR].[COLOR=#0000ff]_height[/COLOR][COLOR=#000000])[/COLOR];
    mc.[COLOR=#000080]title_mc[/COLOR].[COLOR=#0000ff]wordWrap[/COLOR] = [COLOR=#000000]**true**[/COLOR];
    mc.[COLOR=#000080]title_mc[/COLOR].[COLOR=#0000ff]multiline[/COLOR] = [COLOR=#000000]**true**[/COLOR];
////////////////////////////////////////////
    mc.[COLOR=#000080]title_mc[/COLOR].[COLOR=#000080]tf[/COLOR].[COLOR=#0000ff]text[/COLOR] = sometesttext[COLOR=#000000][[/COLOR]mc.[COLOR=#000080]ivar[/COLOR][COLOR=#000000]][/COLOR];

    //******** this portion how to determines in order to display 
short text and long text..

////////////////////////////////////////////    
    [COLOR=#808080]*//setting txtfield format *[/COLOR]
    myformat = [COLOR=#000000]**new**[/COLOR] [COLOR=#0000ff]TextFormat[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
    myformat.[COLOR=#0000ff]color[/COLOR] = 0xffffff;

    mc.[COLOR=#000080]title_mc[/COLOR].[COLOR=#000080]tf[/COLOR].[COLOR=#0000ff]setTextFormat[/COLOR][COLOR=#000000]([/COLOR]myformat[COLOR=#000000])[/COLOR];

[COLOR=#000000]}[/COLOR]
[/LEFT]
 

thanks in advanced