PDA

View Full Version : fl.* libraries in haxe?


paul.sijpkes
08-18-2009, 05:34 AM
Hi everyone,

I want to be able to port an existing application which uses AS3 and PHP to haXe as I feel the workflow would be smoother, especially moving objects between haXe as3 and haXe PHP. I only have one problem, I really need the fl.controls.* and fl.events.* libraries.

Is there any way of building a swf that contains these libraries from Flash?

I use the fl.controls.TileList class which I have put on the stage in a file called lib.swf, this seems to solve the problem for importing the TileList, but not for the fl.events.ListEvent.

Any help would be greatly appreciated!

NB: Please don't suggest as3swing or arctic as I have already built most of this app and I don't have the time to re-code all the GUIs to use these libraries.

paul.sijpkes
08-19-2009, 02:01 AM
I'm assuming the lack of responses indicates that haXe is either dead or that this is not possible, which sort of defies the whole point of haXe. It would be great if we could do this, and I think the adoption of haXe as a language would be much broader and faster if it was able interact fully with the existing libraries of the languages it is "pseudo" replacing. It appears to be a very powerful language, I was looking forward to using it. :-(

I think I am going to put my faith in the MCMLX compiler instead.

Alex Lexcuk
08-27-2009, 06:30 PM
fl.* in haxe - it's easy

Open flash cs3.
ctrl+l
ctrl+F7

drag all component in library
save fla file as name component
ctrl+enter -> has got component.swf

gen clases example


D:\FLEX\hahe\component>haxe --gen-hx-classes D:\FLEX\hahe\component\conponent.swf

ENTER

import fl.managers.IFocusManagerComponent;
import fl.managers.IFocusManagerGroup;
import fl.controls.listClasses.ICellRenderer;
import fl.controls.listClasses.ListData;
...
...
...
import fl.controls.ScrollPolicy;
import fl.events.DataChangeType;


I am uses flashdevelop -> project -> haxe -> Empty project

new class

/**
* ...
* @author http://www.murmadillo.tut.su/
*/

package ;
import fl.controls.Button;
import flash.Lib;
import flash.display.MovieClip;

class HaxeDoc
{

public function new()
{

}

static function main() {
trace('hello');
flash.Lib.current.addChild(new DocDemoComponent());
}
}


new class

/**
* ...
* @author http://www.murmadillo.tut.su/
*/

package ;
import fl.controls.TextArea;
import flash.display.Sprite;
import fl.controls.Button;


class DocDemoComponent extends Sprite
{

public function new()
{
super();
var bt:Button;
addChild(bt = new Button());
bt.x = 30;
bt.y = 30;
var txt:TextArea;
addChild(txt = new TextArea());
txt.x = 30;
txt.y = 60;
txt.setSize(500, 300);
txt.text = 'Hello HAXE';
for (i in 0...30) txt.appendText(i+'\n');
}

}


project -> properties -> build -> pre-build command line

haxe -main HaxeDoc -swf-lib component.swf -cp hxclasses -swf Main.swf -swf-version 9


F5 ERROR

hxclasses/fl/controls/Button.hx:3: lines 3-11 : Field mouseFocusEnabled has different property access than in fl.managers.IFocusManagerComponent (default should be null)
hxclasses/fl/controls/Button.hx:3: lines 3-11 : Field tabEnabled has different property access than in fl.managers.IFocusManagerComponent (default should be null)
hxclasses/fl/controls/Button.hx:3: lines 3-11 : Field tabIndex has different property access than in fl.managers.IFocusManagerComponent (default should be null)
hxclasses/fl/controls/LabelButton.hx:3: lines 3-21 : Field mouseFocusEnabled has different property access than in fl.managers.IFocusManagerComponent (default should be null)
hxclasses/fl/controls/LabelButton.hx:3: lines 3-21 : Field tabEnabled has different property access than in fl.managers.IFocusManagerComponent (default should be null)
hxclasses/fl/controls/LabelButton.hx:3: lines 3-21 : Field tabIndex has different property access than in fl.managers.IFocusManagerComponent (default should be null)
hxclasses/fl/controls/TextArea.hx:3: lines 3-60 : Field mouseFocusEnabled has different property access than in fl.managers.IFocusManagerComponent (default should be null)
hxclasses/fl/controls/TextArea.hx:3: lines 3-60 : Field tabEnabled has different property access than in fl.managers.IFocusManagerComponent (default should be null)
hxclasses/fl/controls/TextArea.hx:3: lines 3-60 : Field tabIndex has different property access than in fl.managers.IFocusManagerComponent (default should be null)


open file IFocusManagerComponent.hx

package fl.managers;

extern interface IFocusManagerComponent {
var focusEnabled : Bool;
var mouseFocusEnabled(default,null) : Bool;
var tabEnabled(default,null) : Bool;
var tabIndex(default,null) : Int;
function drawFocus(p0 : Bool) : Void;
function setFocus() : Void;
}


way of the experiment

package fl.managers;

extern interface IFocusManagerComponent {
var focusEnabled : Bool;
//var mouseFocusEnabled(default,null) : Bool;
//var tabEnabled(default,null) : Bool;
//var tabIndex(default,null) : Int;
function drawFocus(p0 : Bool) : Void;
function setFocus() : Void;
}


F5

OK works well

http://www.murmadillo.tut.su/m/haxe_fl_component.zip