May 26, 2009 at 22:40[AS3] Exploring cross-scripting, Part 1

While working on a huge AS3 application last month, i discovered the magic of cross-scripting. What’s that s*** ? Following the livedocs :

If two SWF files written with ActionScript 3.0 are served from the same domain–for example, the URL for one SWF file is http://www.example.com/swfA.swf and the URL for the other is http://www.example.com/swfB.swf–then one SWF file can examine and modify variables, objects, properties, methods, and so on in the other, and vice versa. This is called cross-scripting.

But they don’t talk about the multiple problems you can find loading SWFs into SWFs. Here’s my first test with cross-scripting :

multi-swf

(more…)

Written by Rémi.T under Coding.
Tags: , .
Add a comment »

May 3, 2009 at 13:58[AS3] Using the … argument

This argument is very useful. You can type it as Array. It can’t be null :

function pouet(... args:Array):void {
    trace("pouet [", args.length, "]", args);
}

// pouet [ 4 ] pouet,tagada,tsoin,tsoin
pouet("pouet","tagada","tsoin","tsoin");
// pouet [ 4 ] pouet,tagada,,tsoin
pouet("pouet","tagada",null,"tsoin");
// pouet [ 4 ] pouet,tagada,,
pouet("pouet","tagada",null,null);
// pouet [ 4 ] ,,,
pouet(null,null,null,null);
// pouet [ 0 ]
pouet();
Written by Rémi.T under Coding.
Tags: .
Add a comment »

at 13:45[AS3] Using stage.focus

All InteractiveObject based object can be focused :

displayobject_subclasses

You don’t need the fl.managers.FocusManager to set or remove the focus on objects :

// to set the focus
stage.focus = myTextField;

// to remove the focus
stage.focus = null;

If the focused InteractiveObject is hided, it loose the focus :

stage.focus = myTextField;

trace(stage.focus); // output : [object TextField]

myTextField.visible = false;

trace(stage.focus); // output : null

To remove the crappy yellow rect on all focused InteractiveObject :

stage.stageFocusRect = null;
Written by Rémi.T under Coding.
Tags: , .
Add a comment »