Here is a small app I ported from flash. The cool thing is that you don’t need to change any of your code, expect for accounting for the small screen. Of course there are the new multitouch functions that you can take advantage of, but that’s like an added bonus. Check it out. make some apps!
Creating text fields in AS3 is kind of a pain. You have to create a new text field, determine the width of it, format the text, select embedding options etc. It’s enough to have 4 textFields on one class to drive you crazy.
import ia.util.*; var textElement : Text = newText("copy goes here", Formats.defaultFormat());
addChild(textElement);
the Text class extends TextFormat, so you can then manipulate it like you would any other TextFormat field.
These are the paramater it takes:
str:String (String of the text)
format:TextFormat (text format — which you can create in the Formats class)
w:Number = 0 (if you want to set a width to the text, type it here, if this is set to 0, the width will be set according to the text’s length)
wrapMe:Boolean=false (wrap is default as FALSE)
isHtmlText:Boolean =false (HTML is default as FALSE)
embed : Boolean = true (embed is default as FALSE)
The Formats class is just an easy way to keep all of the textFormats organized… kind of like a CSS document.
It’s really simple, but if you don’t already use something like this, it will make your life a lot easier.
I would recommend to use this in conjunction with the runTime fonts loading I wrote about the other day.