This site contains a number of hints and tips from the developers at Awen - mostly to do with Flash and associated technologies.
Due to a recent spate of hacking, we've had to rebuild this site from scratch. Apologies if article links have moved around due to this... but all the old content should still be available.
Annoyingly, we've lost the comments. Sorry!
We had an annoying issue yesterday where we discovered that if we called Flash's print function (via PrintJob) in a full screen AIR app the print dialog wouldn't be shown - it would appear behind the main app window.
Took a bit of hunting around, but eventually we discovered that it was a simple case of setting:
alwaysInFront=false;
on the main AIR window (our main WindowedApplication).
Why it should have been set to true in the first place I have no idea.
Thought this might be useful for other people!
A friend had a weird problem with PNGs in a SWF, and I thought I'd note the solution down here for posterity.
The troublesome SWF was an animation consisting of a single MovieClip on the timeline, inside which was a large number of PNGs, scaled and transformed then tweened to produce the animation.
It all worked fine and ran smoothly. Except when being embedded in any Gecko-based browser (Firefox et al) with the embed wmode set to 'transparent'.
(Where have we heard that one before? Firefox's 'wmode=transparent' handling is just terrible.)
In our (internal) goal to separate content from appearance and to try to get all of our themes/skinning into CSS files, we needed support for specifying sound files via CSS (after all, they're part of the skin!).
So here's a class that'll do it.
<?xml version="1.0"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:sound="com.awen.sound.*"> <mx:Script><![CDATA[ import flash.media.Sound; private function playSound(sndID:String):void { // Retrieve the sound from the skin
It's useful to be able to pass data to Flash code at compile-time rather than at runtime. So during your build process you can in some way configure the build - the obvious reason would be to turn on or off some debugging or instrumentation, but you could also configure features, pass in build numbers, set in initial languages etc. all depending on some build parameters or other.
The obvious way would be to in some way template the .as file you're compiling, like so:
package { public class MyConfigClass {
Recently I've been reworking our in-house build process and dealing with a specific requirement; notably that graphical and text assets (and layouts) be separated out in such a way that they are combined - dynamically - at compile time or at runtime.
I went back and forth through a couple of different ways of doing it, and then threw out a lot of code, realising that I could hijack some of the Flex SDK's features to do it for me.
Not so much a hint or tip - more an experiment.
At Flash on the Beach this year, James Paterson was one of the inspirational speakers. During his talk he showed off a novel 3D sketching tool (well, novel to me, anyway) which let you sketch a pen line on a 2D plane, then rotate, and sketch again, adding another plane to your scribble.
I believe it was written in C or C++ (from memory).
I was asked recently - well, okay, not that recently, I've been busy - about our ActionManager system and how it works. I said that if I had time I'd open-source it; so here's a (cut-down) version of it.
Our system was developed in AS2, and has now been ported to AS3; it's been around for a while now and has taken most of what we've thrown at it.
At its root, it's a simple concept, and it's not far removed from many tweening engines that exist out there.
It is perfectly possible to run an AS2 movie within an AS3 Flash application.
However, my advice would be - don't.
Here are a handful of the problems we've encountered when running any AS2 movie of any complexity within AS3:
In AS3 (and actually using a similar method in AS2) you can make a MovieClip act just like a button like so:
Give your MovieClip 3 frames, labelled _up, _over and _down.
Create your MovieClip:
var clip:MovieClip=new MyClip(); clip.buttonMode=true; // Need this, because otherwise any interactive children will break the button behaviour clip.mouseChildren=false; clip.stop();
Now when you attach your clip to the display tree, it'll show up, over and down states as appropriate.