Currently, there is no obvious option in the Flex Builder interface. But, as a matter of fact, it is quite simple. Create a FlexProject, select AIR - Desktop Application in the first screen and change Main application file from
Then, add some code in the constructor of your main class:
public function ProjectName()
{
var win:NativeWindow =
new NativeWindow(new NativeWindowInitOptions());
win.activate();
win.addEventListener(Event.CLOSE, function():void {
NativeApplication.nativeApplication.exit(0);
});
win.stage.addChild(this);
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
graphics.lineStyle(1, 0, 1);
graphics.drawCircle(100, 100, 80);
}
If you already have a web application and want to create an AIR version of it, extend the main class with one that only adds the AIR hooks.
No comments:
Post a Comment