[haXe] Changing "Using HAXE from AS2" into "Using HAXE from HAXE"

E.P. de Boer eddydeboer1 at home.nl
Thu Apr 20 21:19:10 CEST 2006


Hello,

I'm Eddy de Boer from The Netherlands, new in HAXE land.

As a test I tried to change the AS2 exampe in chapter "Using Haxe from AS2"
on the Haxe site,
into a HAXE hx file and compile it.
I replaced the "_root" with "flash.Lib._root" and imported the
MovieClipLoader and MovieClip objects.

I came up with this code, but somehow it will not compile, probably due to
some very obvious reason.

I tried searching for some hx- hxml- combination examples on the web but
came up empty after
a full night's search.

Could someone check the following out and scould me for what I'm doing
wrong.
I'd really like to understand what needs to be done here.

FILE: AS2Test.hx

		import flash.MovieClipLoader;
		import flash.MovieClip;

		class AS2Test {
		    var mcl : MovieClipLoader;
		    function AS2Test() {
		         var me = this;
		         flash.Lib._root.createEmptyMovieClip("haxe_mc",0);
		         mcl = new flash.MovieClipLoader();
		         mcl.onLoadInit = function() { me.onInit() };
		         mcl.loadClip("haxe.swf", flash.Lib._root.haxe_mc);
		    }

		    function onInit() {
		        var test = new flash.Lib._root.haxe_mc.Test(55);
		        flash.Lib._root.createTextField("tf",1,0,0,100,100);
		        flash.Lib._root.tf.text = test.foo();
		    }
		}

I tried compiling it with this.

FILE: AS2Test.hxml

		-swf AS2Test.swf
		-main AS2Test

Could someone tell me where I'm off




More information about the Haxe mailing list