Monthly Archives: September 2007

Communication between Flex 2 and Flash 9

I found a great tutorial on making Flex and Flash work together.

Here’s how it works…
You can declare a function to take place on the flex SWFLoader component’s “complete” event.
in that function, you can view / edit the contents of the Flash 9 SWF that was loaded via the content property for your SWFLoader. Ex: mySWFLoader.content["element"].

This is particularly useful for allowing an SWF to set the size of the object it is loaded into, trapping events from within the loaded SWF, etc.

Thanks to Hasan Otuome for the original article over at

How to get an SWF to recognize its own filename (Actionscript 3)

I needed to recreate my previous post about finding the filename for a swf’s main timeline for AS3. The problem stemmed from the removal of the “_root” and “_url” properties in Actionscript 3.

Here’s the revised code:’

var myFileName:String;
var myFileNameArray:Array = new Array();
var num:Number;
var thisSWF:String;

// get this SWF's filename
myFileName = this.loaderInfo.url;
myFileNameArray = myFileName.split("/");
num = myFileNameArray.length;

thisSWF = myFileNameArray[num-1];