flash on 2009-2-8
package {
import flash.display.*;
public class FlashTest extends Sprite {
public function FlashTest() {
// AS3 Drawing by Erin B. Lillis
//////////////////////////////////// VARIABLES /////////////////////////////
var sky:Sprite = new Sprite();
var hill:Sprite = new Sprite();
var house:Sprite = new Sprite();
var graveyard:Sprite = new Sprite();
var ghost_mc:MovieClip = new MovieClip();
var moon_mc:MovieClip = new MovieClip();
var bat:Sprite = new Sprite();
var cloud1_mc:MovieClip = new MovieClip();
var cloud2_mc:MovieClip = new MovieClip();
///////////////////////////END VARIABLES//////////////////////////////
////////////////////////BACKGROUND ELEMENTS///////////////////////
//The background sky.
sky.graphics.beginFill(0x000066, 1);
sky.graphics.drawRect(0,0,550,400);
//The shining white moon.
moon_mc.graphics.beginFill(0xFFFFFF);
moon_mc.graphics.drawCircle(80, 40, 40);
moon_mc.x = 400;
moon_mc.y = 25;
//The hill.
with (hill.graphics) {
moveTo(0,400);
beginFill(0x000000, 1);
curveTo(150, 350, 225, 400);
curveTo(375, 300, 550, 400);
}
////////////////////////END BACKGROUND ELEMENTS///////////////////////
////////////////////////THE HOUSE////////////////////////////
with (house.graphics) {
//backhouse
beginFill(0x000000);
drawRect (0, 100, 40, 300);
moveTo(0,65);
lineTo(30,65);
lineTo(50,100);
lineTo(0,100);
//mainhouse
beginFill(0x1b1b1b, 1);
drawRect(25,200,150,200);
//windows
beginFill(0xFFD54F, 1);
drawRect(60,210,20,30);
drawRect(125,210,20,30);
//front steps
beginFill(0x000000, 1);
drawRect(175,360,40,10);
drawRect(175,370,55,10);
drawRect(175,380,70,20);
//rooftop
beginFill(0x1b1b1b);
moveTo (15,200);
lineStyle(3);
lineTo (45,150);
lineTo (160,150);
lineTo (185,200);
//chimney
drawRect(125,115,25,35);
moveTo (120,115);
lineStyle(3);
lineTo(125,108);
lineTo(152,108);
lineTo(156,115);
//porch
drawRect(175,340,40,5);
drawRect(215,345,2,25);
drawRect(205,345,2,25);
drawRect(195,345,2,25);
drawRect(185,345,2,25);
drawRect(175,345,2,25);
//porch roof
drawRect(175,312,40,5);
moveTo (175,290);
lineTo (205, 290);
lineTo(215,312);
lineTo(175,312);
//pillar
lineStyle(4);
moveTo (210, 312);
lineTo(210, 340);
}
////////////////////////END HOUSE//////////////////////////
////////////////////////EXTRAS//////////////////////////
with (graveyard.graphics) {
//grave1
beginFill(0x000000, 1);
moveTo (375,360);
curveTo(385,290,420,360);
//grave2 and 3
beginFill(0x000000, 1);
moveTo (450,365);
curveTo(480,315,480,370);
curveTo(500,340,500,380);
//cross1
lineStyle(4,0x000000);
moveTo (430,355);
lineTo (430,340);
moveTo (425,345);
lineTo (435,345);
//cross2
moveTo (350,355);
lineTo (350,335);
moveTo (345,340);
lineTo (355,340);
}
with (ghost_mc.graphics) {
beginFill(0xFFFFFF, 0.3);
drawCircle (375,185,30);
moveTo (320,365);
curveTo (365,60,460,375);
lineTo(440,350);
lineTo(430,390);
lineTo(415,345);
lineTo(400,375);
lineTo(380,350);
lineTo(360,380);
lineTo(340,345);
lineTo(320,365);
beginFill(0x000000,0.3);
drawCircle (360, 180, 8);
drawCircle (390, 180, 8);
drawCircle (375, 200, 10);
}
with (bat.graphics) {
beginFill(0x000000,1);
drawEllipse (220,100,100,60);
drawCircle (250,118,15);
drawCircle (290,118,15);
drawCircle (270,105,5);
drawEllipse (250,140,14,19);
drawEllipse (279,140,14,19);
}
////////////////////////END EXTRAS//////////////////////////
//Have to addChild to the stage in order to see everything.
stage.addChild(sky);
stage.addChild(hill);
stage.addChild(moon_mc);
stage.addChild(house);
stage.addChild(graveyard);
stage.addChild(ghost_mc);
stage.addChild(bat);
stage.addChild(cloud1_mc);
stage.addChild(cloud2_mc);
}
}
}