views:

3087

answers:

1

Hi, I am a newbie in Flash CS3. I was wondering if anyone could tell me how resize the width of of a movie clip according to the size the size of dynamic text inside it. I did it by creating a text field 'myText' and then converted it to a MovieClip symbol and named the MovieClip as myClip. The text in myText is assigned at run-time and its width changes according to the text.

I did it as follows:- myClip.myText.selectable = false; myClip.mouseChildren = false; myClip.useHandCursor = true; myClip.buttonMode = true; myClip.myText.width = myClip.myText.textWidth + 5;

On doing this I find the clickable area changes according to the size of the text field but the text field doesn't appear at all. Any help is greatly appreciated.

+1  A: 

You need to set myClip.myText.autoSize = TextFieldAutoSize.LEFT, else the textfield will not expand with the text. You do not need to set the width of the movieclip, its size depends on its content. Setting the size will only stretch the content (but for textfields this only works when the text is embedded).

Lillemanden