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