[haXe] access plain javascript libraries from within haxe ?

Nicolas Cannasse ncannasse at motion-twin.com
Mon Jan 22 17:52:21 CET 2007


> var s = untyped __js__("Morph('myFlashObject', {'style': {'width': 
> '300px'}})");
> s();
> 
> (Morph is a class from mochikit library that is included in the html file).
> Moreover, i feel like this is not the good way :) Maybe this can be done 
> in a better way ?
> 
> Any idea ? Am i clear ?
> 
> Thanks for your help !
> And congrats to Nicolas for the awesome language.

The best is then to write an extern class :

extern class Morph {
    public function new( flasobj : String, style : {} );
}

Then in your haXe code :

new Morph("myFlashObject",{ style : { width : '300px' } });

Be also careful because here you're using "Morph" without a package, and
maybe there is one needed in your framework.

Nicolas



More information about the Haxe mailing list