[haXe] calling static function of AS2 classes from haXe

Nicolas Cannasse ncannasse at motion-twin.com
Wed Dec 27 13:19:08 CET 2006


> hello list
> 
> I am trying to use ZigoEngine in my haXe app, but with no results yet.
> Problem is that calling of static function won't work.
> 
> Reflect.callMethod(flash.Lib._global.com.mosesSupposes.fuse.ZigoEngine, 
> flash.Lib._global.com.mosesSupposes.fuse.ZigoEngine.doTween, [mc, '_x', 
> -100, 4]);
> 
> Reflect.callMethod(flash.Lib._global.com.mosesSupposes.fuse.ZigoEngine, 
> Reflect.field(flash.Lib._global.com.mosesSupposes.fuse.ZigoEngine, 
> "doTween"), [mc, "_x", 200, 2]);
> 
> com.mosesSupposes.fuse.ZigoEngine is compiled as part of my SWF library
> 
> trace(Reflect.isFunction(flash.Lib._global.com.mosesSupposes.fuse.ZigoEngine.doTween)); 
> // outputs "true"
> 
> How to call static function from AS2 classes?

The first way should be the good one.
You might prefer to write the following :

var ze : Dynamic = flash.Lib._global.com.mosesSupposes.fuse.ZigoEngine;
Reflect.callMethod(ze,ze.doTween,[mc,'_x',-100,4]);

I don't know about it, but maybe the ZigoEngine requires some kind of 
loop to perform the tweening ?

Nicolas





More information about the Haxe mailing list