AS3
Font embedding in flex
Embedding fonts is always tricky in flash. Since I work on exhibits that load dynamic content my font needs are relatively simple: take a font, make it available to flash, and use it to render type. I need styles and weights (flash understands bold, italic, and bold/italic). And I need it to be reliable. After digging around for a while I am currently using the following solution.
Flex Builder and CVS
I've got my commonly used classes all neatly organized in a single library project, but just to be safe I want backup and the ability to revert to a previous version when I break something. Sometimes you gotta take a step back to build quickly; there'll be plenty of time to break it again after the demo is over... so here's how I got my Library into CVS.
Flex Builder library organization
Organization... what a PITA. Typically in the past I've simply dragged required libraries into my src folder. But since others here at work have begun developing in flex builder I needed to come up with a system that would meet the following requirements:
Somehow I missed this...
While trying to come up with a good way to document the methods and properties of my custom classes written to support projects at work I came across a few forum discussions of something called asdoc. "Hmm, built in to the flex sdk, in the bin folder... current project is AIR, not flex; oh, there's an aasdoc binary, too!" A few minutes later I had the following:
Fixing swf file association in 10.5
A few years ago I was working on an installation making little flash projector clients to be installed at a children's museum. A few days later I was preparing for a presentation, double-clicked a swf file, and it opened in, surprisingly enough, the kiosk client projector I'd published a few days later. Confused, I quit and launched it again. Same results. What was happening was that the swf would open the projector file and then open the swf in an additional window. Since I was working in Flash, installing applications for museums and kiosks, the problem grew worse and worse as I published more and more .app's. I grew used to having to right-click any swf I wanted to open, select "Open With...", scroll waaaaay down the list of prototype and final applications that I'd published until I got to the Flash Player, make sure I was selecting the correct one (the most recent player), and opening the swf. Double click was completely broken, even if I told OS X to associate all swfs with the player. It would always revert to opening in one of my applications.
AS3 tricks 2: singleton for settings
Trick number 2: creating a singleton to load, hold, and apply settings for our AIR application.
AS3 tricks 1: swfs in AIR
Suppose you want to make an AIR application but you have a history of working in actionscript, not mxml. Do you need to learn an entire new language to make AIR applications? No, not really. Flex has a SWFLoader class made just for you, and if you work in fullscreen interactives like me you can let Flex handle screen management and just tell your SWFLoader to fill the stage.
AS3 tricks
I'm currently experimenting with AIR applications as a replacement for our usual practice at work of developing a swf and then publishing it as an .app or .exe in the Flash IDE. I always have Flex Builder open to edit my classes and find it a bit annoying to have to create an empty fla, point it at my main class, and then switch back and forth between flash and flex to publish and test. Now, with a target of an AIR application, I get cross platform compatibility and the ability to test and publish everything from the same IDE (Flex Builder).