TextAnimator AS3
Posted: November 12, 2007 at 9:26 pmkeita over at labs.hellokeita.com has a great utility for animating/typing text here.
The click me link will show up in the output of flash as it is a trace statement.
import br.hellokeita.anim.TextAnimation; TextAnimation.animate("", "Welcome to <font color='#FF0000'><a href='http://labs.hellokeita.com'>labs.hellokeita.com</a></font><br>"+ "Some more text.<br><a href='event:hello world!'><font color='#FF0000'>Click Me.</font></a><br><br>"+ "Welcome to <a href='http://blog.hydrotik.com'><font color='#990000'>blog.hydrotik.com</font></a><br>"+ "Some more text.<br><a href='event:hello world 2!'><font color='#990000'>Click Me.</font></a>", { textField: tf, step: 5, time: 5, delay: 0, characters: "0123456789-#", transition: "easeInOutCubic" }); var style:StyleSheet = new StyleSheet(); var a:Object = new Object(); a.color = 0xFF0000; style.setStyle("a:hover", a); tf.addEventListener("link", clickHandler); function clickHandler(e:TextEvent):void { trace(e.type); // link trace(e.text); // myEvent }
keita did a great job on this. I simply made a slight modification that allows for href tags as well as nested tags and corrected an import link path. I think he plans on adding support for all tags at some point.
TextAnimator Update Source
The Discussion
see what everyone is saying
man, i discovered this blog only few days ago and i was shoked about the topic you talk about. is exactly what i'm looking for! every time (not exactly.. i'm not looking 4 petronas tower.. but i enjoy it!)
very well done! keep going!
cheers from an italian collegue (not in the flash master way but in the musical one
)
Glad to hear:) Yeah, I decided to hide my Dad's photojourney from the main index page for that reason;)
Keita actually deserves the accolades for this one. He did a great job on this and all of the work!
You should check out his blog, he has some great stuff there.
Hey Donovan,
I updated my TextPattern class to accept any kind of tags not only font or anchor.
Check it out on my repository.
cheers,
I updated the code from your latest rev. Still getting the import error (to the jp. package) which I changed ro point ot your Equations class, I also noticed a problem with the regex on line 12 which I commented out in the TextAnimator class.
Does anyone one know the function that was used on http://labs.hellokeita.com/2007/09/20/textanimation/ that made the animation go backwards? (from a written word animated to nothing)