[mtasc] Beginer question

Nicolas Cannasse ncannasse at motion-twin.com
Fri Nov 26 09:45:31 CET 2004


> Hello, your project looks, very cool,
> and usable.
> But how I could to compile this code?
> 
> deep=100
> this.createEmptyMovieClip("moc",deep++)
> var mc=this["moc"]
> mc.lineStyle(1,0,100)
> mc.lineTo(200,150)
> 
> this version is work, but I do not want to use _root
> and if I write
> _level0.createEmptyMovieClip("moc",deep++)
> then compiler do not find _level0 ? why
> 
> class Test {
>       var deep:Number =100 
> 
>       public function Test() {
> 
> _root.createEmptyMovieClip("moc",deep++)
> var mc=_root.moc
> mc.lineStyle(1,0,100)
> mc.lineTo(200,150)
>       }
> 
>       public static function run() {
>           var app:Test = new Test();
>       }
> }

You have to specify a context, for example :

class Test {
      var deep:Number =100 
      public function Test(rootmc) {
            rootmc.createEmptyMovieClip("moc",deep++)
            var mc=rootmc.moc
            mc.lineStyle(1,0,100)
            mc.lineTo(200,150)
      }
}

and in you SWF, instead of   Test.run(), you do :  new Test(this)

> possible to make some inLine Assembler to code?

No
 
> possible to make swf without swf, only just compile one as script ?

Yes, using the -header flag (see documentation).

Nicolas



More information about the mtasc mailing list