I’ve seen a few people get into a pickle over this one. When you’re developing and testing locally, you need to set the ‘Local Playback Security’ setting (sometimes referred to as the ‘use network services’ option) depending on whether you wish to access local external files (e.g. XML files, or images) or some other server (e.g. your dev backend server). You can’t access both from a locally running SWF anymore, since it’s a security risk. So here’s how to set that option in Flash CS3 / CS4 or from within FlashDevelop.
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:
// UNICODE RANGE REFERENCE
U+0020-U+0040, // Punctuation, Numbers
U+0041-U+005A, // Upper-Case A-Z
U+005B-U+0060, // Punctuation and Symbols
U+0061-U+007A, // Lower-Case a-z
U+007B-U+007E, // Punctuation and Symbols
Extended ranges (if multi-lingual required)
U+0080-U+00FF, // Latin I
U+0100-U+017F, // Latin Extended A
U+0400-U+04FF, // Cyrillic
U+0370-U+03FF, // Greek
U+1E00-U+1EFF, // Latin Extended Additional
[Embed(source = '../fonts/myfont.ttf', fontName = 'MY_FONT',
fontWeight = 'regular', unicodeRange =
mimeType = 'application/x-font')]
public static const MY_FONT :Class;
public static const DEFAULT_FONT :String = "MY_FONT";
public static const DEFAULT_TEXT_COLOUR :int = 0xFFFFFF;
public static const DEFAULT_TEXT_SIZE :int = 14;
public static const MY_TEXT_FORMAT :TextFormat = new
TextFormat(DEFAULT_FONT, DEFAULT_TEXT_SIZE, DEFAULT_TEXT_COLOUR);
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.
Well, sort of. I just added an OpenSearch plugin to the site, that adds a ‘spikything’ search option to the search drop-down in FireFox 2+ and IE7+. To add the search plugin on your browser, click the drop down arrow on the search bar in your browser (top-right) and click ‘Add spikything search’.
Here’s more info on how to do this yourself.
I just stumbled across this rather useful OpenType font editor. Called typelight, there are freeware and business licensing options available and you should certainly consider it before forking out for something like Fontographer.
I cobbled this Webcam effect together for no other reason than creative curiosity – a digital hall of mirrors thing, I suppose. Best viewed on your laptop, since it requires Flash and a Webcam…
And for the techies, here’s the source code (zipped FLA).
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.
I’ve been asked a few times how to create effects that require multiple instances of the Flash Player on a page to remain ‘in sync’, even with user interaction. Reading and writing to cookies frequently is inefficient and resource heavy. Also, when you have more than 2 SWFs, deciding which SWF updates who becomes tricky – especially if someone decides to change or remove an instance, or an instance which you picked as ‘master’ is not loaded, for some reason.
So, I came up with this solution, using LocalConnection with a twist, which works pretty well. But, if anyone has a better method, drop it in a comment below 🙂