haXe Forum > import problems

  • Hello,

    I'm new to haxe and am trying to compile the follwing simple example:

    import flash.MovieClip;
    
    class Test {
        static function main() {
            var mc : MovieClip = flash.Lib.current;
            mc.beginFill(0x0000FF);
            mc.moveTo(50, 50);
            mc.moveTo(100, 50);
            mc.moveTo(100, 100);
            mc.moveTo(50, 100);
            mc.endFill();
            trace("Hello World !");
        }
    }

    using the following hxml file:

    -swf9 test.swf
    -main Test

    I have two machines that I am using to do this. On one machine I used the Windows setup program. On this machine the program compiles just fine.

    I have another machine where I've manually installed haxe because I do not have admin access. On this machine I get the following error:

    Test/src/Test.hx:1: characters 0-23 : Class not found : flash.MovieClip

    I've setup the following user Environment Variables:

    HAXEPATH = C:\Documents and Settings\mness\Development\Motion-Twin\haxe\
    HAXE_LIBRARY_PATH = %HAXEPATH%std:.\
    NEKO_INSTPATH = C:\Documents and Settings\mness\Development\Motion-Twin\neko

    I'm not certain why the compiler is finding the imported class on one machine and not the other. Is there something that is done in the installer (like registry settings) that I can't do manually?

    Any help would be appreciated.

    Thanks,
    Mike

  • Shouldn't that be:
    import flash.display.MovieClip
    ?

  • You should either use the suggestion from the post above, or change the compiling target.

    -swf test.swf

    Means that you are compiling AVM2 SWF, in AVM2 SWF MovieClip lives in the flash.display.* package. However, this MovieClip doesn't have moveTo / lineTo methods, in AVM2 they ware relocated to MovieClip.graphics object.

  • Thanks! Both of these suggestions worked. I was using the -swf build target on my other box and -swf9 on this one. I was confused by the fact that it compiled on one box and not the other. But it is all clear now. Thanks again!

    Mike

< Prev | Page 1 / 1 | Next >