-
-
Save litvil/148012236c6ab55a0545 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package { | |
//import necessary classes | |
import flash.display.Sprite; | |
import flash.display.Graphics; | |
public class Circle extends Sprite { | |
private var canvas:Sprite = new Sprite(); | |
private var gr:Graphics = canvas.graphics; | |
public function Circle() { | |
// constructor code | |
trace("drawing a Circle"); | |
drawCircle(); | |
drawSquare(); | |
drawTriangle(); | |
addChild(canvas); | |
} | |
//draw Circle method | |
private function drawCircle():void { | |
//drawing circle inside the graphics object | |
gr.lineStyle(6, 0x0000FF, 0.5); | |
gr.beginFill(0xFF0000, 0.5); | |
gr.drawCircle(200, 200, 50); | |
gr.endFill(); | |
} | |
//draw Square method | |
private function drawSquare():void { | |
//drawing circle inside the graphics object | |
gr.lineStyle(6, 0x0000FF, 0.5); | |
gr.beginFill(0xFF0000, 0.5); | |
gr.drawRect(100, 100, 50, 50); | |
gr.endFill(); | |
} | |
//draw Triangle method | |
private function drawTriangle():void { | |
//drawing circle inside the graphics object | |
gr.lineStyle(6, 0x0000FF, 0.5); | |
gr.beginFill(0xFF0000, 0.5); | |
gr.moveTo(0,0); | |
gr.lineTo(50,50); | |
gr.lineTo(0,50); | |
gr.lineTo(0,0); | |
gr.endFill(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment