TextShortcuts Example

I was searching the other day to find some examples demonstrating the use of the TextShortcuts classes of the AS3 Tweener API. The truth is that I didn’t find something specific, so I thought to myself why don’t you try using the Tweener the normal way. So I did, I created a textField with some initial text value and I tried to animate the content of the textField. Surprisingly, the textField disappeared after testing and I was a bit confused about what happened. The code that I initially used was this single actionscript line:


Tweener.addTween(_myTextField, {_text: "RandomText", time: 1, transition:"easeOutQuad"});

As I said, this didn’t seem to work so after a lot of expreriments and tests, I found out that I had to come up with a way to update the textFormat of the textField continuously to actually see the animation. So I added an onUpdate method to achieve that.


Tweener.addTween(_myTextField, {_text:"Random Text", time: 1, transition: "easeOutQuad", onUpdate: updateTextFromat});

private function updateTextFormat():void {
   _textFormat.setTextFormat(_myFormat);
}

That did the work, although I didn’ t like the animation at all! Anyway, I thought that was useful for some of you.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.