Friday, 11 July 2014

Setting up AS3

Alright. As I said earlier, lets fill in something in the empty space this time.

With reference to my previous post, we gotta start with the document class to create our SWF file. So, lets draw a simple circle in the empty space this time. Shall we?

Just go to the 'Initialize_Test' class that we have already created as part of ‘Classes and OOP’ and paste the below code.


package
{
 import flash.display.Sprite;
 
 public class Initialize_Test extends Sprite
 {
 public function Initialize_Test()
 {
 graphics.beginFill(0xff0000);
 graphics.drawEllipse(100, 100, 100, 100);
 graphics.endFill();
 }
 }
}

Click on run and check if you get a red circle in the SWF file output. There we go with something on the blank space ;-)

You should be seeing the below pic created by yourselves.

Fortunately, there is nothing much to understand in this code. I have just used few of the drawing commands to draw the circle. Lets get into details of that very soon!