# AS3 TextButton Class

**URL:** <https://forum.kirupa.com/t/as3-textbutton-class/305622>\
**Category:** open source\
**Created:** [February 28, 2010, 10:15pm UTC](https://forum.kirupa.com/t/as3-textbutton-class/305622 "2010-02-28T22:15:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![duncanhall](https://avatars.discourse-cdn.com/v4/letter/d/ad7895/32.png) [@duncanhall](https://forum.kirupa.com/u/duncanhall)\
**Post date:** [February 28, 2010, 10:15pm UTC](https://forum.kirupa.com/t/as3-textbutton-class/305622/1 "2010-02-28T22:15:55Z")

</div>

I’ve written a class that greatly simplifies the process of creating a button from a simple text label. The simplest example of creating a new instance of a TextButton is as shown:

```auto

var home:TextButton = new TextButton("Home");
addChild(home.button);

```

It also supports setting the style of each button state via a TextFormat object, as well as the ability to use embedded fonts.

Full source, docs and examples here: [http://blog.duncanhall.net/2010/02/actionscript-as3-text-button-class/](http://blog.duncanhall.net/2010/02/actionscript-as3-text-button-class/)

Let me know what you think.
