# Change font size with actionscript

**URL:** <https://forum.kirupa.com/t/change-font-size-with-actionscript/17684>\
**Category:** Uncategorized\
**Created:** [April 8, 2003, 7:25am UTC](https://forum.kirupa.com/t/change-font-size-with-actionscript/17684 "2003-04-08T07:25:29Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![zephn](https://avatars.discourse-cdn.com/v4/letter/z/5f8ce5/32.png) [@zephn](https://forum.kirupa.com/u/zephn)\
**Post date:** [April 8, 2003, 7:25am UTC](https://forum.kirupa.com/t/change-font-size-with-actionscript/17684/1 "2003-04-08T07:25:29Z")

</div>

can you change font size with action script?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 8, 2003, 7:39am UTC](https://forum.kirupa.com/t/change-font-size-with-actionscript/17684/2 "2003-04-08T07:39:31Z")

</div>

you can use the TextFormat object

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

```

or html formatting

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

```

😉 =)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 8, 2003, 7:42am UTC](https://forum.kirupa.com/t/change-font-size-with-actionscript/17684/3 "2003-04-08T07:42:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 8, 2003, 7:51am UTC](https://forum.kirupa.com/t/change-font-size-with-actionscript/17684/4 "2003-04-08T07:51:29Z")

</div>

letter by letter or the whole text?

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 8, 2003, 7:54am UTC](https://forum.kirupa.com/t/change-font-size-with-actionscript/17684/5 "2003-04-08T07:54:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 8, 2003, 8:15am UTC](https://forum.kirupa.com/t/change-font-size-with-actionscript/17684/6 "2003-04-08T08:15:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 8, 2003, 8:15am UTC](https://forum.kirupa.com/t/change-font-size-with-actionscript/17684/7 "2003-04-08T08:15:55Z")

</div>

you rock

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 8, 2003, 8:45am UTC](https://forum.kirupa.com/t/change-font-size-with-actionscript/17684/8 "2003-04-08T08:45:06Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 8, 2003, 8:46am UTC](https://forum.kirupa.com/t/change-font-size-with-actionscript/17684/9 "2003-04-08T08:46:41Z")

</div>

_blinks sleepily_ who has more authority a senior member or an afternoon sleeper? _blinks some more_

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 8, 2003, 9:02am UTC](https://forum.kirupa.com/t/change-font-size-with-actionscript/17684/10 "2003-04-08T09:02:05Z")

</div>

an afternoon sleeper!! 😛

```auto
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 😉

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 8, 2003, 9:05am UTC](https://forum.kirupa.com/t/change-font-size-with-actionscript/17684/11 "2003-04-08T09:05:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 8, 2003, 9:07am UTC](https://forum.kirupa.com/t/change-font-size-with-actionscript/17684/12 "2003-04-08T09:07:53Z")

</div>

oops… i forgot something 😛

```auto
myTextField.enlargeShrink(smin, smax, ms);

```

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 8, 2003, 9:09am UTC](https://forum.kirupa.com/t/change-font-size-with-actionscript/17684/13 "2003-04-08T09:09:52Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 8, 2003, 9:11am UTC](https://forum.kirupa.com/t/change-font-size-with-actionscript/17684/14 "2003-04-08T09:11:50Z")

</div>

> _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 😛

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 8, 2003, 9:14am UTC](https://forum.kirupa.com/t/change-font-size-with-actionscript/17684/15 "2003-04-08T09:14:57Z")

</div>

> _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 😉

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 8, 2003, 9:19am UTC](https://forum.kirupa.com/t/change-font-size-with-actionscript/17684/16 "2003-04-08T09:19:37Z")

</div>

now it’s centered…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 8, 2003, 9:23am UTC](https://forum.kirupa.com/t/change-font-size-with-actionscript/17684/17 "2003-04-08T09:23:29Z")

</div>

coolio

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 8, 2003, 9:27am UTC](https://forum.kirupa.com/t/change-font-size-with-actionscript/17684/18 "2003-04-08T09:27:24Z")

</div>

> _Originally posted by zephn_  
> **coolio**

ehmm… what!? 😛

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 8, 2003, 9:28am UTC](https://forum.kirupa.com/t/change-font-size-with-actionscript/17684/19 "2003-04-08T09:28:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 8, 2003, 9:31am UTC](https://forum.kirupa.com/t/change-font-size-with-actionscript/17684/20 "2003-04-08T09:31:49Z")

</div>

oh!! 😛

no problem man =)

[Next page](https://forum.kirupa.com/t/change-font-size-with-actionscript/17684.md?page=2)
