Ming the Tutorial


Text

First, load a font:

$f = new SWFFont(filename);
where filename is an fdb file. (Yes, another ad hoc file format- you create fdb files from swt flash template files with Ming's makefdb utility.) The SWFFont object provides some font metric information for you:
$f->getAscent();
$f->getDescent();
$f->getLeading();
$f->getWidth(string);
Each method yields the demanded metric as a number, scaled to a font height of 1024. Unless you're displaying your text at a height of 1024, you'll need to multiply the returned number by height/1024.

Your average text-fu looks like:

$t = new SWFText();
$t->setFont($f);
$t->setHeight(240);
$t->setColor(0xff, 0, 0);
$t->moveTo(10,250);
$t->addString("no, please!  not my toes!");
You add an SWFText to your movie with the SWFMovie add method and animate with the returned handle, just like with shapes.

next: example!

Macromedia(r) and Flash(tm) are trademarks or registered trademarks of Macromedia, Inc. in the United States and/or other countries.
Macromedia(r) does not sponsor, affiliate, or endorse this product and/or services.