Working with asfunction in AS2 Class Files
Tuesday, January 29th, 2008Flash 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 http://someURL.com 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 »




