est ici une classe je me suis vite fait que vous pourriez trouver utiles:
package
{
import flash.text.TextField;
import flash.display.Bitmap;
import flash.display.BitmapData;
public class BitmapText extends Bitmap
{
// vars
private var _textf:TextField;
/**
* Draws text onto the bitmap
* @param tf The TextField to draw
*/
public function drawText(tf:TextField):void
{
_textf = tf;
bitmapData = new BitmapData(tf.width,tf.height,true);
bitmapData.draw(tf);
}
/**
* Update text
* @param t The new text
*/
public function set text(t:String):void
{
if(_textf)
{
_textf.text = t;
drawText(_textf);
}
}
}
}
Et pour utiliser cette classe:
var t:TextField = new TextField();
t.text = "some copy";
var bt:BitmapText = new BitmapText();
bt.drawText(t);
addChild(bt);
bt.text = "some new text lol";
Comme vous pouvez le voir, vous pouvez facilement mettre à jour le texte via :
BitmapText.text = "new value";
TextArea.editable = true OU false –