Tuesday, November 10, 2009

AS3: Adding a Sprite as a child to a Flex Container for example a Canvas

From http://www.sebastiaanholtrop.com/archives/3 use:


import mx.core.*;

var my_canvas:Canvas = new Canvas();
var my_uic:UIComponent = new UIComponent();
var my_sprite:Sprite = new Sprite();

my_canvas.addChild(my_uic);
my_uic.addChild(my_sprite);

Sunday, November 8, 2009

Flex 3: Adding you custom component sources in the compiler

Rather then copying custom or external code libraries to your source, it is better to add it using mxmlc compiler option "--source-path=/your/path/here".

Thursday, November 5, 2009

AS3: Enabling scaling in AS3 for your games or movies

By default AS3 set scaling to NO_SCALE. If you want to override this so that your games or movies scale properly use:

stage.scaleMode = StageScaleMode.SHOW_ALL;
once your stage has been initialized.