PDA

View Full Version : TextFields



Chamzee
May 4th, 2008, 10:28 AM
Hey guys,

I want to convert a textfield, containing a few words, to a movieclip.

Can this be done in actionscript 3, if so, how?

I need to convert it so i can tween the text alpha and so on.

Groady
May 4th, 2008, 10:33 AM
Well you can't really 'convert' it but you can add it to a Movieclip. Assuming your textfield is called 'myTextField' you would do something like this:


var myMC:MovieClip = new MovieClip();
myMC.addChild(myTextField);

then you can simply tween the alpha of myMC.

Alex Lexcuk
May 4th, 2008, 10:40 AM
Use myBitmapData.draw(my_text); It's work mega good.


var my_text:TextField = new TextField();
my_text.text = "bitmap text";
var format = new TextFormat();
format.color = 0x111111; format.size = 50; format.font = "Arial";
my_text.autoSize = TextFieldAutoSize.LEFT; my_text.defaultTextFormat = format;
my_text.selectable = false; my_text.mouseEnabled = true; my_text.border=true; my_text.multiline=true;
my_text.htmlText = "<b> THIS<br>MEGA<br>GOOD";

var myBitmapData:BitmapData;
var bmp:Bitmap;
bmp= new Bitmap(myBitmapData);
myBitmapData.draw(my_text);
addChild(bmp);


Example
http://kind-armadillo.pochta.ru/FlaAC3/mur_cube_text_mod.swf
http://kind-armadillo.pochta.ru/FlaAC3/mur_cube_text_mod.rar

Chamzee
May 4th, 2008, 10:58 AM
Groady: i tryed that already, but i couldnt get it to work on the alpha, only on the location of the mc

Chamzee
May 4th, 2008, 11:09 AM
Alex Lexcuk:

If i usae a Bitmap to draw my text, how do i tween the alpha of a bitmap? i cannot use the Tween object..