Create a MovieClip

MovieClip class makes part of the flash.display package. We can create a MovieClip directly using the keyword new.

It will be displayed as soon as it will be added to a visible container, just use addChild() method.

package;
import flash.display.MovieClip;
import flash.Lib;
      class Main
      {
      		static function main()
      		{
      			new Main();
      		}
      		public function new()
      		{
      			/* Create a new MovieClip */
      			var myFirstMC = new MovieClip();
      			/* use the graphics property which corresponds to a Graphics object
      			Then you can access to different methods which allow you to create 
      			a vector shape*/
      			var g = myFirstMC.graphics;

      			g.lineStyle(1, 0x000000);
      			g.drawRect(0,0,100,100);

      			Lib.current.addChild(myFirstMC);
      		}
      }

Compile and t(a)est it !

haxe -swf9 ../bin/output.swf -main Main 

output

Alternative content

Get Adobe Flash player

(47 times)