Tag Archives: AS3

ActionScript 3.0

CoolIris type thing in 30 lines

InterServer Web Hosting and VPS
 

How to embed fonts in pure AS3

On my travels as a contractor, I’ve seen various methods used for embedding fonts in ActionScript 3 projects (code embedded, creating font SWFs, runtime loading, etc). Each of them has its own merits (and limitations), but generally you’re looking for something that’s easy to do, easy to maintain (for others, not just yourself) and of course that works!

So, here’s the method I use for pure AS3 projects I compile with the Flex SDK. I embed the TTF or OTF file in a ‘Style’ class and include those font files in the CVS/SVN repository too – it does my head in when fonts go missing, because a designer can’t remember which font they used:


 

Through experience, this seems to be the most robust and maintainable way of dealing with fonts (not to throw out more flexible, but perhaps less robust ways, such as runtime loading), especially when you need control of the unicode ranges you are embedding – which I have included for reference.

How to use ExternalInterface to integrate AS3 with JavaScript

Here’s a quick snippet of code for setting up intercommunication between a SWF and JavaScript, using ExternalInterface:

Head tracking in 3D

I started trying to find useful things to do with face detection, but with limited success. I tried using the Libspark Haar Cascades implementation of face detection with Papervision3D to create a sort of head tracking effect, but it’s a little flaky – partly because of poor tracking accuracy and partly because it’s too CPU intensive. You can view it on its own page here.

How Wonderfl

I’ve been playing around a little with the online Flash building tool, Wonderfl. If you haven’t seen it already, I urge you to create an account and have a go. You can browse the weird things that people have created, fork other users’ code, or write you own from scratch and see the results compiled online in realtime. It’s a great way to learn graphics coding in AS3 I reckon.

Wonderfl