Archive for the ‘Tips and Tricks’ Category

Communication between Flex 2 and Flash 9

I found a great tutorial on making Flex and Flash work together.
http://www.actionscript.org/resources/articles/501/1/Flex-2-and-Flash-9-Together/Page1.html

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 actionscript.org

Bubbl.us for logic diagrams

Not sure how many people have discovered bubbl.us
It is a brainstorming / mindmapping web-app that lets you share / collaborate with other users.
I’ve started using it for logic-diagrams instead and sharing them with dev + design teams at work.

Fun stuff.

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];
trace(thisSWF);

How to get an SWF to recognize its own filename

The following actionscript on the main timeline will produce a string of “filename.swf”


var myFileName:String = myFileName = this._url;
myFileNameArray = myFileName.split("/");
num = myFileNameArray.length;


thisSWF = myFileNameArray[num-1];
trace(thisSWF);

Thanks to the Actionscript.org forums for the idea.

Return top

Updates