Archive for January, 2008

Working with asfunction in AS2 Class Files

Tuesday, January 29th, 2008
ActionScript 2.0

Flash Player has supported a limited subset of the HTML specification since version 6 — just set a text field’s htmlText property to an HTML-formatted string and you’re good to go.  Fortunately, <a> (anchor) tags are among the supported few, which means you can even put working hyperlinks inside your text.  Not only that, but Flash includes a special protocol, asfunction, that allows you to trigger functions from those hyperlinks, in case you prefer to do that instead of visiting URLs.  ActionScript 3.0 uses a different approach, but if you’re coding in AS1 or 2, just replace with asfunction:someFunction,someParam, as described elsewhere on this blog.  If you’re coding in timeline keyframes, it’s all pretty straightforward.  But asfunction can seemingly break when used in custom class files.  Here’s what’s going on and how to fix it.  Keep reading »

Moock’s Pitch for AS3 (It’s a Good One!)

Monday, January 21st, 2008
ActionScript 3.0 Flash

O’Reilly and Adobe have teamed up on a new website dedicated to Rich Internet Applications (RIA).  Among the first featured articles is a comparative look at ActionScript 3.0 and its predecessors, 2.0 and 1.0, in which Colin Moock offers a number of solid insights (and encouragements) toward learning the new language.

How to Play a Timeline Backwards (with Easing!)

Wednesday, January 2nd, 2008
ActionScript 2.0 ActionScript 3.0

Reader James Colvin wrote me in mid-December to ask if I had any thoughts on playing a timeline backwards.  As it turns out, this question comes up every now and then on the Adobe forums, where longtime regular kglad usually posts his very handy custom function in reply.  In kglad’s version, the MovieClip.nextFrame() and prevFrame() methods are used in cahoots with setInterval() to accomplish the goal.  He often assigns the function to the Object.prototype property of the MovieClip class, which makes the new functionality available to all movie clips (a pre-AS3 technique).

My initial reaction was to search the forums and send back a link, but James’ question had an interesting twist:  could this non-standard timeline movement include easing?  Wow, what a cool challenge!  So I thought about it off and on over the holidays, and a neat solution occurred to me just this morning.  Keep reading »