I'm using AS3 and I created a popup box as such:
var s:Sprite = new Sprite();
var shape:Shape = new Shape();
shape.name = "HitArea";
s.addChild( shape );
shape.graphics.lineStyle( 4, 0xFFFFFF, 1 );
shape.graphics.beginFill( 0xFFFFFF );
shape.graphics.drawRoundRect( 0, 0, 200, 30, 10, 10 );
var text:TextField = new TextField();
text.text = "";
text.autoSize = TextFieldAutoSize.CENTER;
text.name = "Text";
text.x = 100;
text.y = 10;
s.addChild( text );
return s;
Which creates a 200 x 30 box that serves as an error box. The text sometimes goes outside the box though, as I use
( s.getChildByName( 'Text' ) as TextField ).text = "Text here";
how do I fit the box to the text? Or is there a better alternative?