C'è un modo per disegnare del testo in un DisplayObject o Shape usando solo ActionScript? L'unico modo che posso trovare sul web è creare un campo di testo, ma non posso aggiungere un TF a DisplayObject o Shape.Disegna testo sulla forma in ActionScript 3
Edit:
risolti grazie a viatropos.
Per chiunque che è interessato:
DisplayObject
attua IBitmapDrawable
che può essere passato come argomento della funzione draw
di un oggetto BitmapData
, che poi può essere disegnata utilizzando graphics.beginBitmapFill
.
var textfield:TextField = new TextField;
textfield.text = "text";
var bitmapdata:BitmapData = new BitmapData(theWidth, theHeight, true, 0x00000000);
bitmapdata.draw(textfield);
graphics.beginBitmapFill(bitmapdata);
graphics.drawRect(0, 0, theWidth, theHeight);
graphics.endFill();