as3开发air

flashdevelop F5运行,(aswing只是辅助有个按钮,去掉也行),具体怎么编译运行没研究

new project ->As3AirProject

package 
{
	import flash.desktop.NativeApplication;
	import flash.display.NativeWindow;
	import flash.display.NativeWindowInitOptions;
	import flash.display.Sprite;
	import flash.filesystem.File;
	import org.aswing.event.AWEvent;
	import org.aswing.JFrame;
	import org.aswing.AsWingManager;
	import org.aswing.JButton;
	import org.aswing.FlowLayout;
	import org.aswing.JOptionPane;
	import org.aswing.JWindow;
	/**
	 * ...
	 * @author yongkang
	 */
	public class Main extends Sprite 
	{
	private var myFrame:JFrame;
    private var myButton:JButton;

    public function Main() {
        AsWingManager.initAsStandard(this);
	
        myButton = new JButton("Click Me");
        myButton.addActionListener(__buttonClicked);

        myFrame = new JFrame(this, "My Frame");
        myFrame.getContentPane().setLayout(new FlowLayout());
        myFrame.getContentPane().append(myButton);

        myFrame.setSizeWH(300, 200);
        myFrame.show();
    }

    private function __buttonClicked(e:AWEvent):void {
		var init:NativeWindowInitOptions = new NativeWindowInitOptions();
		init.maximizable = true;
        init.minimizable = true;
        init.resizable = true;
		var window:NativeWindow = new NativeWindow(init);
		window.activate();
        JOptionPane.showMessageDialog("Hello", "Hello, World!");
    }

		
	}
	
}
 

你可能感兴趣的:(Flash,AIR)