[haXe] Bound HaxeClass to MovieClipAsset

Nicolas Cannasse ncannasse at motion-twin.com
Fri Sep 8 09:37:41 CEST 2006


> Hi list,
> I´v got a question related to class linkage to a movieClip.
> Ussually I build my GUI forms in flash and export the movie with a
> className="mypackage.myUIclass" in action-script.
> 
> I was wondering if exist any way to "link" this MovieClip to an haxe
> class.??.
> I mean something like,
> -main  Application
> myUIcomponent -linkto controls.haxeui

This is very easy to do :

a) create a lib SWF with a MC Linkage id "mypack.MyClass"
b) have your haxe class "mypack.MyClass" extends "flash.MovieClip"
c) compile your class and link with the lib SWF
d) use the following to create an instance :

var parent = flash.Lib.current;
var x = cast(parent.attachMovie("mypack.MyClass","a",0),mypack.MyClass);

Nicolas



More information about the Haxe mailing list