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: , .
1 comment »

February 8, 2009 at 13:46Papervision3D and ShadowCaster

remitoffoli-com_demo-1

Here is a Papervision3D demo using Zupko’s ShadowCaster class and a little tip to prevent the floor plane from hiding the objects :

viewport.containerSprite.sortMode = ViewportLayerSortMode.INDEX_SORT;
viewport.getChildLayer(floor,true).layerIndex = 1;
viewport.getChildLayer(objects,true).layerIndex = 2;

Click once to lift object’s layer up and once more to release it :
View the demo

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