TwelvestoneFlash

aswing?


Sign in

  • Waiting for Godot ( 730 k posts )
    Just conversation.
  • Thunder Dome ( 23 k posts )
    Photoshop Tennis and Collabs.
  • Photography ( 5.1 k posts )
    For all you shutterbugs, sh...
  • Flash ( 18 k posts )
    ActionScripting to tweens, ...
  • Front End ( 5.9 k posts )
    general front end design an...
  • Back End ( 9.7 k posts )
    serverside scripting, progr...
  • Projects and Theory ( 12 k posts )
    This forum is for discussio...
  • FAQ ( 269 posts )
    All those nagging questions...
  • Design ( 17 k posts )
    graphics & all aspects of g...
  • Purgatory ( 3.6 k posts )
    12stone Jail, feel free to ...
JLM
 
2008-06-20

Anyone got any opinions on aswing - have you used it or know much about - what would be like to work with?

Anyway thought I would post a snipit that was on the haXe list, but also usefull as I think it explains the ins and outs of utilising flash based classes in haXe.

JC> Hello list, JC> Since a few months I started playing with Haxe, and underway I JC> discovered the powerfull aswing gui framwork. I found no JC> detailed information how to use it in Haxe, so I (and Iiley, the JC> creator of aswing) thought maybe a good idea to share it. JC> I'm sure that aswing and haxe together are a powerfull base to JC> build internet apps on. Hope it can help! JC> Regards, JC> Johan

JC>
JC> Download latest version of aswing/as3 JC>http://aswing.googlecode.com/files/aswing_1.4_allinone.zip JC> Extract it in a folder. JC> Go to the AsWing\bin directory, and rename the file AsWing.swc to AsWing.zip JC> Unzip this file with your favorite zip utility JC> Now you have two files: catalog.xml and library.swf. It is the JC> library.swf that is important for us. JC> Start up the command prompt, and go to the directory where library.swf resides. JC> Execute: haxe --gen-hx-classes library.swf JC> It will genererate all the extern haxe classes in a subdir JC> “hxclasses” needed to use aswing in haxe.

JC> Now let's start a new haxe project for testing. JC> Create a new project directory, and copy the complete generated tree (“org” directory) in here. JC> Copy the library.swf also in your project directory. This library JC> will be compiled into your final movie.

JC> Create a file Hello.hx:

JC> import org.aswing.JButton; JC> import org.aswing.JFrame; JC> import org.aswing.geom.IntDimension;

JC> import flash.Lib; JC> import flash.display.Sprite; JC> import flash.display.StageScaleMode;

JC> class Hello extends Sprite { JC> public function new() { JC> super(); JC> //create a frame JC> var frame : JFrame = new JFrame( this, "HelloApp" ); JC>
JC> frame.setSize(new IntDimension( 200, 120 ) ); JC> //create a button JC> var button:JButton = new JButton("Hello from AsWing in Haxe!"); JC>
JC> //add the button to the frame JC> frame.getContentPane().append(button); JC>
JC> //add the frame to the stage JC> Lib.current.stage.addChild(this); JC> this.stage.scaleMode = StageScaleMode.NO_SCALE; JC>
JC> //show it! JC> frame.show(); JC> } JC> public static function main() { JC> new Hello(); JC> } JC> }

JC> Create a file Hello.hxml:

JC> -swf Hello.swf JC> -swf-header 600:400:21:ffffff JC> -main Hello JC> -swf-lib library.swf JC> -swf-version 9

JC> Now let's compile it by executing: haxe Hello.hxml

JC> When everything went fine, you should have a flash file Hello.swf JC> displaying a frame with a button in it, saying Hello!

JC> Notes: JC> I had to use haxe version 1.19, the older one didn't work. There JC> was an error generating the extern tree.

JC> Tip:use GUIBuilder from AsWing to design complex interfaces. With JC> it you can generate as3 code, wich is easily to port to JC> haxe.

Sorry, you must be a member to post to a conversation. Either log in or sign up to get involved.
TwelvestoneFlash

aswing?