Change font size with actionscript

can you change font size with action script?

you can use the TextFormat object

myTextFormat = new TextFormat();
myTextFormat.size = 16;
myTextField.setTextFormat(myTextFormat);

or html formatting

myTextField.html = true;
myTextField.htmlText = "<font size='16'>zephn</font>";

:wink: =)

awesome thats a begginging for what i’m trying tor esearch thanksman.

what I’m trying to do is have letters enlarge and shring without breaking apart or tweening much… any tips for me friend?
Andrew

letter by letter or the whole text?

[size=1]ps. please don’t say letter by letter!! :P[/size]

Letter by letter but if that doesn’t work i’ll settle for whole sentences

ok… i’ll see if i can come up with something worthy :wink:

you rock

hahaha kax!! why don’t just give an example for letter by letter with three words i guess it doesn’t hurt so much for u…

blinks sleepily who has more authority a senior member or an afternoon sleeper? blinks some more

an afternoon sleeper!! :stuck_out_tongue:

TextField.prototype.enlargeShrink = function(smin, smax, ms) {
	field = this;
	field.format = new TextFormat();
	field.format.size = field.s=smin;
	field.setTextFormat(field.format);
	field.autoSize = true;
	field.d = false;
	es = function () {
		field.s == smin ? field.d=true : field.s == smax ? field.d=false : null;
		!field.d ? field.format.size=(field.s--) : field.format.size=(field.s++);
		field.setTextFormat(field.format);
		field.autoSize = true;
updateAfterEvent();
	};
	field.interval = setInterval(es, ms);
};
myTextField.enlargeShrink(10, 20, 1000/24);

it still can be optimized a lot… and right now the whole text is resized.

i’ll keep woking on it :wink:

gaaahhh it’ll take me some time to translate but i’ll get the hang of it. thanks kax i really appretiate it.

oops… i forgot something :stuck_out_tongue:

myTextField.enlargeShrink(smin, smax, ms);

smin is the minimum size
smax is the maximum size
ms is the milliseconds between every execution

how would i apply this to text or where would i enter the text? i do not see how i would take “the red fox jumped over the fence” and make this script work with it?

Originally posted by zephn
gaaahhh it’ll take me some time to translate but i’ll get the hang of it. thanks kax i really appretiate it.

i’m not done yet…

i still need to move the text field to keep it centered, and the letter by letter thing :stuck_out_tongue:

Originally posted by zephn
how would i apply this to text or where would i enter the text? i do not see how i would take “the red fox jumped over the fence” and make this script work with it?

place a dynamic text field on the stage, write the text and put myTextField in the instance name of the text field :wink:

now it’s centered…

coolio

Originally posted by zephn
coolio

ehmm… what!? :stuck_out_tongue:

hehe my way of saying that’s cool and thank you again for your awesome incredible help.

oh!! :stuck_out_tongue:

no problem man =)