Question : Positioning dynamic text fields in a 9-slice movie clip [example attached]

A quick explanation I'm trying to create an FLA file with a box component in it that is resizable without distortion and the textboxes inside are populated from an XML file. Therefore the only thing defined in the FLA is the width and position of the  component. The rest text color, background etc are from XML.

The problem I have run across is have dynamic text feilds inside a slice-9 symbol. I have managed to create two samples here:
http://dropbox.aiwmedia.com/roadmaps.fla

Option 1 has the text fields physically in the movies and the opti actionscript on 2 has the text dynamically attached. Both options have undistorted boxes and text. However the textfields don't appear left aligned as you can see. I'm wondering how i can left align? Maybe i can use this._width and do some calculations to position the text?

Also any ideas on how i can change the background colors? I tried putting the box in another MC and then giving it a name and using setRBG but this distorts the box.

Answer : Positioning dynamic text fields in a 9-slice movie clip [example attached]

the TextField is stretching because it is INSIDE the box movieclip. The instance of that movieclip is being stretched (when you set _width)  so all child objects will also get stretched (unless positioned in the center of the 9-slice guides ).

To get around this, the textField should not be a child object of the 'box'. it should be added to the right hand side.  You can add both to a 'container' movieclip if necessary.

As for the colour - why not create a number of symbols in the library e.g. BoxRed, BoxBlue, BoxGreen. Then add them dynamically depending on data from the XML.

The only other way to have full conrol of the colour is to use the drawing API to draw the boxes from scratch with code. This is much easier to do in Actionscipt 3.
Random Solutions  
 
programming4us programming4us