1
J'utilise AS3 et je crée une boîte de pop-up en tant que tel:automatiquement redimensionnée Sprite en Actionscript 3
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;
Ce qui crée une boîte de 200 x 30 qui sert une boîte d'erreur. Le texte sort parfois de la boîte, comme j'utilise
(s.getChildByName('Text') as TextField).text = "Text here";
comment puis-je adapter la boîte au texte? Ou y a-t-il une meilleure alternative?