Skip to content

Instantly share code, notes, and snippets.

@k0t0vich
Created August 31, 2012 17:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save k0t0vich/3556240 to your computer and use it in GitHub Desktop.
Save k0t0vich/3556240 to your computer and use it in GitHub Desktop.
Similar test
class Main extends Sprite
{
private var shape:Shape;
public function new()
{
super();
#if iphone
Lib.current.stage.addEventListener(Event.RESIZE, init);
#else
addEventListener(Event.ADDED_TO_STAGE, init);
#end
}
private function init(e) {
shape = new Shape();
shape.graphics.lineStyle(1, 0xFF0000);
shape.graphics.beginFill(0x00FF00);
shape.graphics.drawCircle(0, 0, 10);
shape.graphics.endFill();
this.addChild(shape);
shape.x = Lib.current.stage.stageWidth / 2;
shape.y = 200;
addEventListener(Event.ENTER_FRAME, enterFraneHandler);
}
private function enterFraneHandler(e:Event):Void {
shape.x = mouseX;
shape.y = mouseY;
}
static public function main()
{
var stage = Lib.current.stage;
stage.scaleMode = nme.display.StageScaleMode.NO_SCALE;
stage.align = nme.display.StageAlign.TOP_LEFT;
Lib.current.addChild(new Main());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment