PDA

View Full Version : setting width from xml data


paulie_h
12-12-2008, 05:10 AM
Hi Guys,

I'm loading a menu form XML in to flash - but am really wondering if it is possible for flash to work out how many characters are being used in a dynamic text field, and make the box/button behind the text 10 pixels wider than that taken up by text. I have attached an example screen capture of the design...

:)

rawmantick
12-12-2008, 05:29 AM
There is a rule:

textField.width = textField.textWidth + 4;
textField.height = textField.textHeight + 4;


This is always enough for any font and any text size.

paulie_h
12-14-2008, 08:50 PM
There is a rule:

textField.width = textField.textWidth + 4;
textField.height = textField.textHeight + 4;


This is always enough for any font and any text size.

Many thanks!

It works. My code is:

roll_mc._width = bttnName.textWidth +30;

lordofduct
12-14-2008, 08:55 PM
NEVERMIND, I'm tired.

paulie_h
12-14-2008, 09:59 PM
all cool LOC?