Section 1
//CButton (Classes.CButton)
package Classes {
import flash.text.*;
import flash.events.*;
import flash.display.*;
public class CButton extends Sprite {
private var m_sFunction:String;
private var m_objParent;
private var m_tfTextFormat:TextFormat;
private var m_sDesc:String;
private var m_txtLabel:TextField;
public function CButton(_arg1, _arg2:String, _arg3:String){
m_objParent = _arg1;
m_sDesc = _arg2;
m_sFunction = _arg3;
m_tfTextFormat = new TextFormat();
m_tfTextFormat.font = "verdana";
m_tfTextFormat.size = 10;
m_tfTextFormat.bold = true;
m_tfTextFormat.color = 0xFFFFFF;
m_tfTextFormat.align = "center";
init();
}
private function init():void{
this.graphics.beginFill(0xCCCCCC, 0.5);
this.graphics.drawRect(0, 0, 150, 15);
this.graphics.endFill();
m_txtLabel = new TextField();
m_txtLabel.x = 0;
m_txtLabel.y = -1;
m_txtLabel.width = 150;
m_txtLabel.height = 20;
m_txtLabel.selectable = false;
m_txtLabel.text = m_sDesc;
m_txtLabel.setTextFormat(m_tfTextFormat);
this.addChild(m_txtLabel);
addEventListener(MouseEvent.MOUSE_DOWN, mouseDown_handler);
}
private function mouseDown_handler(_arg1:Event):void{
var _local2 = m_objParent;
_local2[m_sFunction]();
}
}
}//package Classes
Section 2
//Checkbox (Classes.Checkbox)
package Classes {
import flash.display.*;
import flash.events.*;
public class Checkbox extends Sprite {
private var m_sFunction:String;
private var m_objParent;
private var m_bState:Boolean;
private var m_spMark:Sprite;
public function Checkbox(_arg1, _arg2:Boolean, _arg3:String){
m_objParent = _arg1;
m_bState = _arg2;
m_sFunction = _arg3;
init();
mark();
}
private function init():void{
this.graphics.beginFill(13158, 1);
this.graphics.moveTo(0, 0);
this.graphics.lineStyle(1, 0xCCCCCC, 1);
this.graphics.lineTo(10, 0);
this.graphics.lineTo(10, 10);
this.graphics.lineTo(0, 10);
this.graphics.lineTo(0, 0);
this.graphics.endFill();
m_spMark = new Sprite();
m_spMark.x = 0;
m_spMark.y = 0;
this.addChild(m_spMark);
addEventListener(MouseEvent.MOUSE_DOWN, mouseDown_handler);
}
private function mark():void{
if (m_bState){
m_spMark.graphics.moveTo(-3, -3);
m_spMark.graphics.lineStyle(3, 0xEE00, 1);
m_spMark.graphics.lineTo(6, 11);
m_spMark.graphics.lineTo(11, 0);
} else {
m_spMark.graphics.clear();
};
var _local1 = m_objParent;
_local1[m_sFunction](m_bState);
}
private function mouseDown_handler(_arg1:Event):void{
m_bState = !(m_bState);
mark();
}
}
}//package Classes
Section 3
//GUI (Classes.GUI)
package Classes {
import flash.display.*;
import flash.text.*;
import flash.events.*;
import flash.utils.*;
public class GUI extends Sprite {
private var m_spHelpBtn:CButton;
private var m_iFrameCount:uint;
private var m_spCheckSpawn:Checkbox;
private var m_tfTextFormat:TextFormat;
private var m_spISlider:Slider;
private var m_tTimer:Timer;
private var m_spHelp:Sprite;
private var m_tfBodyTextFormat:TextFormat;
private var m_bHelp:Boolean;
private var m_spBSlider:Slider;
private var m_spClearBmpBtn:CButton;
private var m_objLabels:Object;
private var m_spEraseBtn:CButton;
private var m_spSelectList:SelectList;
private var m_bOpen:Boolean;
private var m_bMOver:Boolean;
private var m_objLink;
private var m_spContainer:Sprite;
public function GUI(_arg1){
m_objLink = _arg1;
m_spHelp = new Sprite();
m_objLabels = new Object();
m_bOpen = false;
m_bMOver = false;
m_bHelp = false;
m_iFrameCount = 0;
m_tfTextFormat = new TextFormat();
m_tfTextFormat.font = "verdana";
m_tfTextFormat.size = 10;
m_tfTextFormat.bold = true;
m_tfTextFormat.color = 0xFFFF00;
m_tfTextFormat.align = "left";
m_tfBodyTextFormat = new TextFormat();
m_tfBodyTextFormat.font = "verdana";
m_tfBodyTextFormat.size = 10;
m_tfBodyTextFormat.color = 0xDDDDDD;
m_tfBodyTextFormat.align = "left";
initElements();
addEventListener(MouseEvent.MOUSE_MOVE, mouseMove_handler);
addEventListener(MouseEvent.MOUSE_OUT, mouseOut_handler);
addEventListener(Event.ENTER_FRAME, enterFrame_handler);
m_bOpen = true;
m_bMOver = true;
showHelp();
startTimer();
y = -50;
}
private function getTextField(_arg1:String, _arg2:String, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):void{
m_objLabels[_arg1] = new TextField();
m_objLabels[_arg1].x = _arg3;
m_objLabels[_arg1].y = _arg4;
m_objLabels[_arg1].width = _arg5;
m_objLabels[_arg1].height = _arg6;
m_objLabels[_arg1].selectable = false;
m_objLabels[_arg1].text = _arg2;
m_objLabels[_arg1].wordWrap = true;
m_objLabels[_arg1].setTextFormat(m_tfTextFormat);
m_spContainer.addChild(m_objLabels[_arg1]);
}
private function startTimer():void{
m_tTimer = new Timer(1000, 0);
m_tTimer.addEventListener("timer", timeExpire_handler);
m_tTimer.start();
}
public function setSpawnInterval(_arg1:uint):void{
m_objLink.spawnInt = (_arg1 * ((_arg1 > 1)) ? 3 : 1);
}
public function setBrushSize(_arg1:uint):void{
m_objLink.brushSizeX = (_arg1 * 3);
m_objLink.brushSizeY = (_arg1 * 3);
}
private function initElements():void{
this.graphics.beginFill(0xFFFFFF, 0.1);
this.graphics.drawRect(0, 350, 500, 100);
this.graphics.endFill();
this.graphics.beginFill(0xFFFFFF, 0.3);
this.graphics.drawRect(0, 397.5, 500, 2);
this.graphics.endFill();
m_spContainer = new Sprite();
m_spContainer.x = 10;
m_spContainer.y = 355;
m_spSelectList = new SelectList(this, m_objLink.pixelProperties);
m_spSelectList.x = 70;
m_spSelectList.y = 0;
m_spContainer.addChild(m_spSelectList);
getTextField("type", "Pixel type: ", -5, 0, 80, 20);
m_spBSlider = new Slider(this, "setBrushSize");
m_spBSlider.x = 70;
m_spBSlider.y = 30;
m_spContainer.addChild(m_spBSlider);
getTextField("size", "Brush size: ", -5, 22, 80, 20);
m_spISlider = new Slider(this, "setSpawnInterval");
m_spISlider.x = 80;
m_spISlider.y = 65;
m_spContainer.addChild(m_spISlider);
getTextField("int", "Spawn rate: ", -5, 60, 95, 20);
m_spCheckSpawn = new Checkbox(this, false, "setPlaceSpawn");
m_spCheckSpawn.x = 226;
m_spCheckSpawn.y = 4;
m_spContainer.addChild(m_spCheckSpawn);
getTextField("spawn", "Spawn:", 180, 0, 45, 20);
m_spCheckSpawn = new Checkbox(this, false, "setErase");
m_spCheckSpawn.x = 226;
m_spCheckSpawn.y = 24;
m_spContainer.addChild(m_spCheckSpawn);
getTextField("erase", "Erase:", 185, 20, 40, 20);
m_spCheckSpawn = new Checkbox(this, false, "setMarkState");
m_spCheckSpawn.x = 305;
m_spCheckSpawn.y = 4;
m_spContainer.addChild(m_spCheckSpawn);
getTextField("sleep", "Negative:", 245, 0, 60, 20);
m_spEraseBtn = new CButton(this, "Remove spawn locations", "removeSpawnLocations");
m_spEraseBtn.x = 330;
m_spEraseBtn.y = 2;
m_spContainer.addChild(m_spEraseBtn);
m_spClearBmpBtn = new CButton(this, "Remove pixels", "clearBitmap");
m_spClearBmpBtn.x = 330;
m_spClearBmpBtn.y = 23;
m_spContainer.addChild(m_spClearBmpBtn);
this.addChild(m_spContainer);
m_spHelpBtn = new CButton(this, "Open/close instructions", "showHelp");
m_spHelpBtn.x = 330;
m_spHelpBtn.y = 63;
m_spContainer.addChild(m_spHelpBtn);
this.addChild(m_spContainer);
m_objLabels["help"] = new TextField();
m_objLabels["help"].x = 0;
m_objLabels["help"].y = -300;
m_objLabels["help"].width = 500;
m_objLabels["help"].height = 400;
m_objLabels["help"].selectable = false;
m_objLabels["help"].htmlText = "<font color='#ffffff'><b>Instructions</b>\nSandbox version 1.0 | 07-10-06\n\nHow to play:\nClick and drag the mouse over the empty black region to add elements to the simulation.\nThe type and amount of elements, aswell as several other properties can be set within the menu.\n\nControls:\n- 'Pixel type'\nUse this select list to select the type of element for your brush.\n- 'Brush size'\nUse this slider to select the size of your brush.\n- 'Spawn' checkbox\nChecking this box will create a spawn point whenever you add elements to the simulation.\n- 'Erase' checkbox\nCheck this box to set your brush to erase elements.\n- 'Negative' checkbox\nChecking this box will hide all inactive pixels.\n- 'Remove spawn locations'\nRemove all spawn locations from the simulation.\n- 'Remove pixels'\nRemova all elements from the simulation.\n- 'Spawn rate'\nThe rate at which elements will spawn from a spawn location.\n\n\nDesigned and programmed by Rens Rongen.\nBased on Hell of Sand Falling Game.\nEmail: rens.rongen@gmail.com</font>";
m_objLabels["help"].wordWrap = true;
m_objLabels["help"].setTextFormat(m_tfBodyTextFormat);
m_spHelp.graphics.beginFill(0, 1);
m_spHelp.graphics.drawRect(-10, -305, 500, 348);
m_spHelp.graphics.endFill();
m_spHelp.graphics.beginFill(0, 1);
m_spHelp.graphics.drawRect(-10, 42, 300, 50);
m_spHelp.graphics.endFill();
m_spHelp.graphics.beginFill(0xFFFFFF, 0.3);
m_spHelp.graphics.drawRect(290, 45, 2, 50);
m_spHelp.graphics.endFill();
m_spHelp.addChild(m_objLabels["help"]);
getTextField("frameTxt", "FPS: ", 215, 60, 30, 20);
getTextField("frameRate", "", 250, 60, 30, 20);
}
public function setBrushType(_arg1:uint):void{
m_objLink.brushType = _arg1;
}
private function timeExpire_handler(_arg1:TimerEvent):void{
m_objLabels["frameRate"].text = m_iFrameCount;
m_objLabels["frameRate"].setTextFormat(m_tfBodyTextFormat);
m_iFrameCount = 0;
}
private function mouseMove_handler(_arg1:Event):void{
if (mouseY > 395){
addEventListener(Event.ENTER_FRAME, enterFrame_handler);
m_bMOver = true;
};
}
public function setErase(_arg1:Boolean):void{
m_objLink.eraseState = _arg1;
}
private function mouseOut_handler(_arg1:Event):void{
if ((((mouseY < 350)) && (!(m_bHelp)))){
m_bMOver = false;
};
}
public function setMarkState(_arg1:Boolean):void{
m_objLink.markPixelState = _arg1;
}
private function enterFrame_handler(_arg1:Event):void{
if (!(m_bOpen)){
y = (y - 5);
} else {
if (((!(m_bMOver)) && (m_bOpen))){
y = (y + 5);
};
};
if (y == -50){
m_iFrameCount++;
if (!(m_bOpen)){
m_bOpen = true;
startTimer();
};
};
if (y == 0){
m_bOpen = false;
removeEventListener(Event.ENTER_FRAME, enterFrame_handler);
m_tTimer.stop();
m_iFrameCount = 0;
};
}
public function setPlaceSpawn(_arg1:Boolean):void{
m_objLink.placeSpawn = _arg1;
}
public function removeSpawnLocations():void{
m_objLink.removeSpawnLocations();
}
public function showHelp():void{
m_bHelp = !(m_bHelp);
m_objLink.isPaused = m_bHelp;
if (m_bHelp){
m_spContainer.removeChild(m_spHelpBtn);
m_spHelp.addChild(m_spHelpBtn);
m_spContainer.addChild(m_spHelp);
} else {
m_spContainer.removeChild(m_spHelp);
m_spHelp.removeChild(m_spHelpBtn);
m_spContainer.addChild(m_spHelpBtn);
};
}
public function clearBitmap():void{
m_objLink.clearBitmap();
}
}
}//package Classes
Section 4
//Sandbox (Classes.Sandbox)
package Classes {
import flash.display.*;
import flash.events.*;
public class Sandbox extends Sprite {
private var m_aWaitIndex:Array;
private var m_objBrush:Object;
private var m_iHeight:uint;
private var m_objPixelContainer:Object;
private var m_objParent:Object;
private var m_bitmap:Bitmap;
private var m_objActivePixels:Object;
private var m_bSpawn:Boolean;
private var m_aPixelIndex:Array;
private var m_objSpawn:Object;
private var m_objInactivePixels:Object;
private var m_objMouseXY:Object;
private var m_iWaitColor:Number;
private var m_bitmapData:BitmapData;
private var m_bPaused:Boolean;
private var m_iPixelCount:uint;
private var m_aProperties:Array;
private var m_bMouseDown:Boolean;
private var m_iSpawnInt:uint;
private var m_bRemove:Boolean;
private var m_iSpawnCount:uint;
private var m_aPixelBuffer:Array;
private var m_iWidth:uint;
private var m_bMark:Boolean;
public function Sandbox(_arg1, _arg2:uint=500, _arg3:uint=400){
m_objParent = _arg1;
m_iWidth = _arg2;
m_iHeight = _arg3;
m_bitmap = new Bitmap();
m_bitmapData = new BitmapData(m_iWidth, m_iHeight, false, 0);
m_objActivePixels = new Object();
m_objInactivePixels = new Object();
m_objPixelContainer = new Object();
m_objSpawn = new Object();
m_aPixelIndex = getArray(m_iWidth, m_iHeight);
m_aWaitIndex = getArray(m_iWidth, m_iHeight);
m_aPixelBuffer = new Array();
m_aProperties = [{color:0xCCCCCC, active:0, flammable:0, fire:0, desc:"Wall", bs:0}, {color:0xAA7700, active:1, flammable:0, fire:0, desc:"Sand", bs:0}, {color:0, active:1, flammable:0, fire:1, desc:"Fire", bs:0}, {color:0x990066, active:1, flammable:1, fire:0, desc:"Oil", bs:2}, {color:0xFF, active:1, flammable:0, fire:0, desc:"Water", bs:0}, {color:0xFF00, active:0, flammable:1, fire:0, desc:"Plant", bs:10}, {color:0x623800, active:0, flammable:1, fire:0, desc:"Wood", bs:40}, {color:0x333300, active:1, flammable:1, fire:0, desc:"Gunpowder", bs:0}];
m_objBrush = new Spawn(this, 3, 3, 0, 0, 0);
m_objMouseXY = {x:mouseX, y:mouseY};
addListeners();
updateBitmap();
m_iPixelCount = 0;
m_iSpawnCount = 0;
m_iSpawnInt = 1;
m_iWaitColor = 0;
this.addChild(m_bitmap);
m_bMouseDown = false;
m_bRemove = false;
m_bMark = false;
m_bSpawn = false;
m_bPaused = false;
addSpawnLocation(150, 10, 1, 4, 1);
addSpawnLocation(350, 10, 3, 4, 1);
}
private function wakeUpPixels(_arg1, _arg2, _arg3):void{
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
_local4 = m_objPixelContainer[_arg1].x;
_local5 = m_objPixelContainer[_arg1].y;
_local6 = (_local4 - m_objPixelContainer[_arg1].d);
if ((((_local6 >= 0)) && ((_local6 < m_iWidth)))){
_local7 = m_aPixelIndex[(_arg3 - 1)][(_local4 - 1)];
if ((((_local7 == m_aWaitIndex[(_arg3 - 1)][(_local4 - 1)])) && (!((_local7 == -1))))){
m_aPixelBuffer[m_aPixelBuffer.length] = _local7;
m_aWaitIndex[(_arg3 - 1)][(_local4 - 1)] = -1;
};
_local7 = m_aPixelIndex[(_arg3 - 1)][_local4];
if ((((_local7 == m_aWaitIndex[(_arg3 - 1)][_local4])) && (!((_local7 == -1))))){
m_aPixelBuffer[m_aPixelBuffer.length] = _local7;
m_aWaitIndex[(_arg3 - 1)][_local4] = -1;
};
_local7 = m_aPixelIndex[(_arg3 - 1)][(_local4 + 1)];
if ((((_local7 == m_aWaitIndex[(_arg3 - 1)][(_local4 + 1)])) && (!((_local7 == -1))))){
m_aPixelBuffer[m_aPixelBuffer.length] = _local7;
m_aWaitIndex[(_arg3 - 1)][(_local4 + 1)] = -1;
};
if ((_local5 - 1) >= 0){
_local7 = m_aPixelIndex[(_local5 - 1)][_local4];
if ((((_local7 == m_aWaitIndex[(_local5 - 1)][_local4])) && (!((_local7 == -1))))){
m_aPixelBuffer[m_aPixelBuffer.length] = _local7;
m_aWaitIndex[(_local5 - 1)][_local4] = -1;
};
};
if (_local5 >= 0){
_local7 = m_aPixelIndex[_local5][_local4];
if ((((_local7 == m_aWaitIndex[_local5][_local4])) && (!((_local7 == -1))))){
m_aPixelBuffer[m_aPixelBuffer.length] = _local7;
m_aWaitIndex[_local5][_local4] = -1;
};
};
if ((((m_aPixelIndex[_arg3][_local6] == m_aWaitIndex[_arg3][_local6])) && (!((m_aPixelIndex[_arg3][_local6] == -1))))){
m_aPixelBuffer[m_aPixelBuffer.length] = m_aPixelIndex[_arg3][_local6];
m_aWaitIndex[_arg3][_local6] = -1;
};
};
}
private function renderPixels():void{
var _local1:String;
var _local2:uint;
var _local3:uint;
var _local4:uint;
var _local5:uint;
var _local6:Boolean;
var _local7:Boolean;
for (_local1 in m_objActivePixels) {
_local2 = m_objPixelContainer[_local1].x;
_local3 = m_objPixelContainer[_local1].y;
_local4 = _local2;
_local5 = (_local3 + ((Math.random() < 0.9)) ? 1 : 0);
if (_local5 >= m_iHeight){
m_aPixelIndex[_local3][_local2] = -1;
delete m_objActivePixels[_local1];
delete m_objPixelContainer[_local1];
m_bitmapData.setPixel(_local2, _local3, 0);
} else {
_local6 = true;
if (m_objPixelContainer[_local1].t == 4){
_local6 = setWater(_local2, _local3);
};
if (_local6){
if (m_aProperties[m_objPixelContainer[_local1].t].fire){
if (m_objPixelContainer[_local1].s <= 0){
setFire(_local2, _local3);
m_bitmapData.setPixel(_local2, _local3, 0);
delete m_objActivePixels[("p" + m_aPixelIndex[_local3][_local2])];
delete m_objPixelContainer[("p" + m_aPixelIndex[_local3][_local2])];
m_aPixelIndex[_local3][_local2] = -1;
} else {
m_objPixelContainer[_local1].s = (m_objPixelContainer[_local1].s - Math.random());
};
} else {
if (((!((m_aPixelIndex[_local5][_local4] == -1))) && (!((_local3 == _local5))))){
if (m_objPixelContainer[_local1].f){
m_objPixelContainer[_local1].f = false;
m_objPixelContainer[_local1].d = ((Math.random() < 0.5)) ? -1 : 1;
};
if (m_aPixelIndex[_local3][(_local4 + m_objPixelContainer[_local1].d)] != -1){
m_objPixelContainer[_local1].d = -(m_objPixelContainer[_local1].d);
};
_local4 = (_local4 + m_objPixelContainer[_local1].d);
if (m_aPixelIndex[_local5][_local4] != -1){
_local5 = _local3;
} else {
m_objPixelContainer[_local1].f = true;
};
if (m_aPixelIndex[_local5][_local4] != -1){
_local4 = _local2;
};
};
if (!((((_local3 == _local5)) && ((_local2 == _local4))))){
m_bitmapData.setPixel(_local2, _local3, 0);
m_aPixelIndex[_local5][_local4] = m_aPixelIndex[_local3][_local2];
m_aPixelIndex[_local3][_local2] = -1;
wakeUpPixels(_local1, _local4, _local5);
m_objPixelContainer[_local1].x = _local4;
m_objPixelContainer[_local1].y = _local5;
m_bitmapData.setPixel(_local4, _local5, m_aProperties[m_objPixelContainer[_local1].t].color);
} else {
if ((_local3 + 1) < m_iHeight){
_local7 = (m_objPixelContainer[("p" + m_aPixelIndex[(_local3 + 1)][_local2])] == undefined);
if (((!(_local7)) && (!((((m_aPixelIndex[_local3][(_local2 + 1)] == -1)) || ((m_aPixelIndex[_local3][(_local2 - 1)] == -1))))))){
_local7 = m_aProperties[m_objPixelContainer[("p" + m_aPixelIndex[(_local3 + 1)][_local2])].t].active;
if ((((((m_aPixelIndex[(_local3 + 1)][_local2] == m_aWaitIndex[(_local3 + 1)][_local2])) && (!((m_aPixelIndex[(_local3 + 1)][_local2] == -1))))) || (!(_local7)))){
m_aWaitIndex[_local3][_local2] = m_aPixelIndex[_local3][_local2];
delete m_objActivePixels[_local1];
if (m_bMark){
m_bitmapData.setPixel(_local2, _local3, 0);
};
};
};
};
};
};
};
};
};
emptyBuffer();
}
private function mouseUpHandler(_arg1:Event):void{
m_bMouseDown = false;
removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
}
public function mouseLeaveHandler(_arg1:Event):void{
m_bMouseDown = false;
removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
}
private function enterFrameHandler(_arg1:Event):void{
if (!(m_bPaused)){
renderPixels();
runSpawn();
};
}
public function set eraseState(_arg1:Boolean):void{
m_bRemove = _arg1;
}
private function addSpawnLocation(_arg1:uint, _arg2:uint, _arg3:uint, _arg4:uint=5, _arg5:uint=1):void{
var _local6:String;
_local6 = ("s" + m_iSpawnCount);
m_objSpawn[_local6] = new Spawn(this, _arg4, _arg5, _arg1, _arg2, _arg3, m_iSpawnInt);
m_iSpawnCount++;
}
private function updateBitmap():void{
m_bitmap.bitmapData = m_bitmapData;
}
private function mouseDownHandler(_arg1:Event):void{
addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
m_objMouseXY.x = mouseX;
m_objMouseXY.y = mouseY;
m_objBrush.positionX = mouseX;
m_objBrush.positionY = mouseY;
if (((m_bSpawn) && (m_aProperties[m_objBrush.spawnType].active))){
addSpawnLocation(m_objBrush.positionX, m_objBrush.positionY, m_objBrush.spawnType, Math.round((m_objBrush.spawnSizeX / 3)), Math.round((m_objBrush.spawnSizeY / 3)));
} else {
getNewPixels(m_objBrush);
};
m_bMouseDown = true;
}
public function get markPixelState():Boolean{
return (m_bMark);
}
public function get pixelProperties():Array{
return (m_aProperties);
}
private function markSleepingPixels():void{
var _local1:uint;
var _local2:uint;
_local1 = 0;
while (_local1 < m_aPixelIndex.length) {
_local2 = 0;
while (_local2 < m_aPixelIndex[0].length) {
if (m_objPixelContainer[("p" + m_aPixelIndex[_local1][_local2])] != undefined){
if (((!((m_aPixelIndex[_local1][_local2] == -1))) && (m_aProperties[m_objPixelContainer[("p" + m_aPixelIndex[_local1][_local2])].t].active))){
if (m_bMark){
m_bitmapData.setPixel(_local2, _local1, m_iWaitColor);
} else {
m_bitmapData.setPixel(_local2, _local1, m_aProperties[m_objPixelContainer[("p" + m_aPixelIndex[_local1][_local2])].t].color);
};
};
};
_local2++;
};
_local1++;
};
}
public function set placeSpawn(_arg1:Boolean):void{
m_bSpawn = _arg1;
}
public function set brushType(_arg1:uint):void{
m_objBrush.spawnType = _arg1;
}
public function get brushSizeX():uint{
return (m_objBrush.spawnSizeX);
}
public function get brushType():uint{
return (m_objBrush.spawnType);
}
private function mouseMoveHandler(_arg1:Event):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local2 = -((m_objMouseXY.x - mouseX));
_local3 = -((m_objMouseXY.y - mouseY));
_local4 = Math.ceil((Math.sqrt(((_local2 * _local2) + (_local3 * _local3))) / Number((m_objBrush.spawnSizeX * 0.5))));
_local5 = (_local3 / _local4);
_local6 = 0;
while (_local6 < _local4) {
m_objBrush.positionX = (m_objMouseXY.x + Math.round(((_local2 / _local4) * _local6)));
m_objBrush.positionY = (m_objMouseXY.y + Math.round((_local6 * _local5)));
if (((m_bSpawn) && (m_aProperties[m_objBrush.spawnType].active))){
addSpawnLocation(m_objBrush.positionX, m_objBrush.positionY, m_objBrush.spawnType, Math.round((m_objBrush.spawnSizeX / 3)), Math.round((m_objBrush.spawnSizeY / 3)));
} else {
getNewPixels(m_objBrush);
};
_local6++;
};
m_objMouseXY.x = mouseX;
m_objMouseXY.y = mouseY;
}
private function addListeners():void{
addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
addEventListener(Event.ENTER_FRAME, enterFrameHandler);
m_objParent.addEventListener(Event.MOUSE_LEAVE, mouseLeaveHandler);
}
private function runSpawn():void{
var _local1:String;
for (_local1 in m_objSpawn) {
if (m_objSpawn[_local1].spawnDelay == 0){
getNewPixels(m_objSpawn[_local1], true);
m_objSpawn[_local1].spawnDelay = m_objSpawn[_local1].startDelay;
} else {
m_objSpawn[_local1].spawnDelay = (m_objSpawn[_local1].spawnDelay - 1);
};
};
}
public function set pixelProperties(_arg1:Array):void{
m_aProperties = _arg1;
}
private function getNewPixels(_arg1:Object, _arg2:Boolean=false):void{
var _local3:uint;
var _local4:uint;
var _local5:uint;
var _local6:uint;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:String;
_local3 = 0;
while (_local3 < _arg1.spawnSizeY) {
_local4 = 0;
while (_local4 < _arg1.spawnSizeX) {
_local5 = ((_arg1.positionX - (_arg1.spawnSizeX / 2)) + _local4);
_local6 = ((_arg1.positionY - (_arg1.spawnSizeY / 2)) + _local3);
_local7 = (-(Math.ceil((_arg1.spawnSizeX / 2))) + _local4);
_local8 = (-(Math.ceil((_arg1.spawnSizeY / 2))) + _local3);
_local9 = Math.sqrt(((_local7 * _local7) + (_local8 * _local8)));
if ((((_local9 < Math.abs((_arg1.spawnSizeX / 2)))) || ((((_arg1.spawnSizeX == 1)) || ((_arg1.spawnSizeY == 1)))))){
if ((((((((_local5 > -1)) && ((_local5 < m_iWidth)))) && ((_local6 > 0)))) && ((_local6 < m_iHeight)))){
if (((m_bRemove) && (!(_arg2)))){
if (m_aPixelIndex[_local6][_local5] != -1){
wakeUpPixels(("p" + m_aPixelIndex[_local6][_local5]), _local5, _local6);
emptyBuffer();
delete m_objActivePixels[("p" + m_aPixelIndex[_local6][_local5])];
delete m_objPixelContainer[("p" + m_aPixelIndex[_local6][_local5])];
m_bitmapData.setPixel(_local5, _local6, 0);
m_aPixelIndex[_local6][_local5] = -1;
};
} else {
if (m_aPixelIndex[_local6][_local5] != -1){
delete m_objActivePixels[("p" + m_aPixelIndex[_local6][_local5])];
delete m_objPixelContainer[("p" + m_aPixelIndex[_local6][_local5])];
};
_local10 = ("p" + m_iPixelCount);
m_objPixelContainer[_local10] = {x:_local5, y:_local6, a:m_aProperties[_arg1.spawnType].active, t:_arg1.spawnType, d:((Math.random() < 0.5)) ? -1 : 1, f:false};
if (_arg1.spawnType == 2){
m_objPixelContainer[_local10].l = (1 + Math.round((Math.random() * 20)));
m_objPixelContainer[_local10].s = 0;
};
m_aPixelIndex[_local6][_local5] = m_iPixelCount;
if (m_objPixelContainer[_local10].a){
m_objActivePixels[_local10] = _local10;
} else {
m_objInactivePixels[_local10] = _local10;
};
m_bitmapData.setPixel(m_objPixelContainer[_local10].x, m_objPixelContainer[_local10].y, m_aProperties[m_objPixelContainer[_local10].t].color);
m_iPixelCount++;
};
};
};
_local4++;
};
_local3++;
};
}
public function get brushSizeY():uint{
return (m_objBrush.spawnSizeY);
}
private function getArray(_arg1:Number, _arg2:Number):Array{
var _local3:Array;
var _local4:uint;
var _local5:uint;
_local3 = new Array();
_local4 = 0;
while (_local4 < _arg2) {
_local3[_local3.length] = new Array();
_local5 = 0;
while (_local5 < _arg1) {
_local3[(_local3.length - 1)][_local3[(_local3.length - 1)].length] = -1;
_local5++;
};
_local4++;
};
return (_local3);
}
private function setFire(_arg1:uint, _arg2:uint):void{
var _local3:Boolean;
var _local4:uint;
var _local5:Number;
var _local6:uint;
var _local7:uint;
var _local8:uint;
var _local9:uint;
_local3 = ((_arg1 - 1) >= 0);
if (_local3){
_local6 = (!((m_aPixelIndex[_arg2][(_arg1 - 1)] == -1))) ? m_aProperties[m_objPixelContainer[("p" + m_aPixelIndex[_arg2][(_arg1 - 1)])].t].bs : 0;
_local7 = ((Math.random() > 0.9)) ? Math.round((5 / (_local6 + 1))) : 1;
_local3 = ((_arg1 - _local7) >= 0);
if (((!((m_aPixelIndex[_arg2][(_arg1 - _local7)] == -1))) && (_local3))){
wakeUpPixels(("p" + m_aPixelIndex[_arg2][(_arg1 - _local7)]), (_arg1 - _local7), _arg2);
if (m_aProperties[m_objPixelContainer[("p" + m_aPixelIndex[_arg2][(_arg1 - _local7)])].t].flammable){
if (m_objInactivePixels[("p" + m_aPixelIndex[_arg2][(_arg1 - _local7)])] != undefined){
m_aPixelBuffer[m_aPixelBuffer.length] = m_aPixelIndex[_arg2][(_arg1 - _local7)];
};
m_objPixelContainer[("p" + m_aPixelIndex[_arg2][(_arg1 - _local7)])].s = m_aProperties[m_objPixelContainer[("p" + m_aPixelIndex[_arg2][(_arg1 - _local7)])].t].bs;
m_objPixelContainer[("p" + m_aPixelIndex[_arg2][(_arg1 - _local7)])].t = 2;
m_objPixelContainer[("p" + m_aPixelIndex[_arg2][(_arg1 - _local7)])].l = Math.round((Math.random() * 20));
m_bitmapData.setPixel((_arg1 - _local7), _arg2, 0xFF0000);
};
};
};
_local3 = ((_arg1 + 1) < m_iWidth);
if (_local3){
_local6 = (!((m_aPixelIndex[_arg2][(_arg1 + 1)] == -1))) ? m_aProperties[m_objPixelContainer[("p" + m_aPixelIndex[_arg2][(_arg1 + 1)])].t].bs : 0;
_local8 = ((Math.random() > 0.9)) ? Math.round((5 / (_local6 + 1))) : 1;
_local3 = ((_arg1 + _local8) < m_iWidth);
if (((!((m_aPixelIndex[_arg2][(_arg1 + _local8)] == -1))) && (_local3))){
wakeUpPixels(("p" + m_aPixelIndex[_arg2][(_arg1 + _local8)]), (_arg1 + _local8), _arg2);
if (m_aProperties[m_objPixelContainer[("p" + m_aPixelIndex[_arg2][(_arg1 + _local8)])].t].flammable){
if (m_objInactivePixels[("p" + m_aPixelIndex[_arg2][(_arg1 + _local8)])] != undefined){
m_aPixelBuffer[m_aPixelBuffer.length] = m_aPixelIndex[_arg2][(_arg1 + _local8)];
};
m_objPixelContainer[("p" + m_aPixelIndex[_arg2][(_arg1 + _local8)])].s = m_aProperties[m_objPixelContainer[("p" + m_aPixelIndex[_arg2][(_arg1 + _local8)])].t].bs;
m_objPixelContainer[("p" + m_aPixelIndex[_arg2][(_arg1 + _local8)])].t = 2;
m_objPixelContainer[("p" + m_aPixelIndex[_arg2][(_arg1 + _local8)])].l = Math.round((Math.random() * 20));
m_bitmapData.setPixel((_arg1 + _local8), _arg2, 0xFF0000);
};
};
};
_local3 = ((_arg2 + 6) < m_iHeight);
if (_local3){
_local6 = (!((m_aPixelIndex[(_arg2 + 1)][_arg1] == -1))) ? m_aProperties[m_objPixelContainer[("p" + m_aPixelIndex[(_arg2 + 1)][_arg1])].t].bs : 0;
_local9 = ((Math.random() > 0.9)) ? Math.round((5 / (_local6 + 1))) : 1;
_local3 = ((_arg2 + _local9) < m_iHeight);
if (((!((m_aPixelIndex[(_arg2 + _local9)][_arg1] == -1))) && (_local3))){
wakeUpPixels(("p" + m_aPixelIndex[(_arg2 + _local9)][_arg1]), _arg1, (_arg2 + _local9));
if (m_aProperties[m_objPixelContainer[("p" + m_aPixelIndex[(_arg2 + _local9)][_arg1])].t].flammable){
if (m_objInactivePixels[("p" + m_aPixelIndex[(_arg2 + _local9)][_arg1])] != undefined){
m_aPixelBuffer[m_aPixelBuffer.length] = m_aPixelIndex[(_arg2 + _local9)][_arg1];
};
m_objPixelContainer[("p" + m_aPixelIndex[(_arg2 + _local9)][_arg1])].s = m_aProperties[m_objPixelContainer[("p" + m_aPixelIndex[(_arg2 + _local9)][_arg1])].t].bs;
m_objPixelContainer[("p" + m_aPixelIndex[(_arg2 + _local9)][_arg1])].t = 2;
m_objPixelContainer[("p" + m_aPixelIndex[(_arg2 + _local9)][_arg1])].l = Math.round((Math.random() * 20));
m_bitmapData.setPixel(_arg1, (_arg2 + _local9), 0xFF0000);
};
};
};
_local3 = ((_arg2 - 5) > 0);
if (_local3){
_local6 = (!((m_aPixelIndex[(_arg2 - 1)][_arg1] == -1))) ? m_aProperties[m_objPixelContainer[("p" + m_aPixelIndex[(_arg2 - 1)][_arg1])].t].bs : 0;
_local9 = ((Math.random() > 0.9)) ? Math.round((5 / (_local6 + 1))) : 1;
_local3 = ((_arg2 - _local9) > 0);
if (((!((m_aPixelIndex[(_arg2 - _local9)][_arg1] == -1))) && (_local3))){
wakeUpPixels(("p" + m_aPixelIndex[(_arg2 - _local9)][_arg1]), _arg1, (_arg2 - _local9));
if (m_aProperties[m_objPixelContainer[("p" + m_aPixelIndex[(_arg2 - _local9)][_arg1])].t].flammable){
if (m_objInactivePixels[("p" + m_aPixelIndex[(_arg2 - _local9)][_arg1])] != undefined){
m_aPixelBuffer[m_aPixelBuffer.length] = m_aPixelIndex[(_arg2 - _local9)][_arg1];
};
m_objPixelContainer[("p" + m_aPixelIndex[(_arg2 - _local9)][_arg1])].s = m_aProperties[m_objPixelContainer[("p" + m_aPixelIndex[(_arg2 - _local9)][_arg1])].t].bs;
m_objPixelContainer[("p" + m_aPixelIndex[(_arg2 - _local9)][_arg1])].t = 2;
m_objPixelContainer[("p" + m_aPixelIndex[(_arg2 - _local9)][_arg1])].l = Math.round((Math.random() * 20));
m_bitmapData.setPixel(_arg1, (_arg2 - _local9), 0xFF0000);
};
};
};
_local4 = Math.round((Math.random() * 3));
_local5 = ((Math.random() > 0.5)) ? -1 : 1;
_local3 = ((((((_arg2 - _local4) > 0)) && (((_arg1 + _local5) >= 0)))) && (((_arg1 + _local5) < m_iWidth)));
if (_local3){
if (m_aPixelIndex[(_arg2 - _local4)][(_arg1 + _local5)] != -1){
_local5 = 0;
};
if (m_aPixelIndex[(_arg2 - _local4)][(_arg1 + _local5)] != -1){
if (!(m_aProperties[m_objPixelContainer[("p" + m_aPixelIndex[(_arg2 - _local4)][(_arg1 + _local5)])].t].active)){
if (!(m_aProperties[m_objPixelContainer[("p" + m_aPixelIndex[(_arg2 - _local4)][(_arg1 + _local5)])].t].fire)){
m_objActivePixels[("p" + m_aPixelIndex[(_arg2 - _local4)][(_arg1 + _local5)])] = m_aPixelIndex[(_arg2 - _local4)][(_arg1 + _local5)];
delete m_objInactivePixels[("p" + m_aPixelIndex[(_arg2 - _local4)][(_arg1 + _local5)])];
m_objPixelContainer[("p" + m_aPixelIndex[(_arg2 - _local4)][(_arg1 + _local5)])].s = m_aProperties[m_objPixelContainer[("p" + m_aPixelIndex[(_arg2 - _local4)][(_arg1 + _local5)])].t].bs;
m_objPixelContainer[("p" + m_aPixelIndex[(_arg2 - _local4)][(_arg1 + _local5)])].t = 2;
m_objPixelContainer[("p" + m_aPixelIndex[(_arg2 - _local4)][(_arg1 + _local5)])].l = Math.round((Math.random() * 30));
};
};
} else {
if (m_aPixelIndex[_arg2][_arg1] != -1){
if (m_objPixelContainer[("p" + m_aPixelIndex[_arg2][_arg1])].l > 0){
m_objPixelContainer[("p" + m_aPixelIndex[_arg2][_arg1])].l--;
m_objPixelContainer[("p" + m_aPixelIndex[_arg2][_arg1])].x = (_arg1 + _local5);
m_objPixelContainer[("p" + m_aPixelIndex[_arg2][_arg1])].y = (_arg2 - _local4);
m_aPixelIndex[(_arg2 - _local4)][(_arg1 + _local5)] = m_aPixelIndex[_arg2][_arg1];
m_aPixelIndex[_arg2][_arg1] = -1;
m_bitmapData.setPixel((_arg1 + _local5), (_arg2 - _local4), 0xFFCC00);
m_bitmapData.setPixel(_arg1, _arg2, 0);
};
};
};
};
}
public function set markPixelState(_arg1:Boolean):void{
if (m_bMark != _arg1){
m_bMark = _arg1;
markSleepingPixels();
};
}
public function set brushSizeX(_arg1:uint):void{
m_objBrush.spawnSizeX = _arg1;
}
public function get placeSpawn():Boolean{
return (m_bSpawn);
}
public function removeSpawnLocations():void{
var _local1:uint;
var _local2:String;
_local1 = 0;
while (_local1 < m_iSpawnCount) {
_local2 = ("s" + _local1);
delete m_objSpawn[_local2];
_local1++;
};
m_iSpawnCount = 0;
}
public function get eraseState():Boolean{
return (m_bRemove);
}
public function set brushSizeY(_arg1:uint):void{
m_objBrush.spawnSizeY = _arg1;
}
private function setWater(_arg1:uint, _arg2:uint):Boolean{
var _local3:Boolean;
var _local4:Boolean;
var _local5:Boolean;
var _local6:Boolean;
var _local7:Boolean;
_local3 = true;
_local4 = ((_arg1 + 1) < m_iWidth);
if (_local4){
if (m_aPixelIndex[_arg2][(_arg1 + 1)] != -1){
if (m_objInactivePixels[("p" + m_aPixelIndex[_arg2][(_arg1 + 1)])] != undefined){
_local5 = (m_objPixelContainer[("p" + m_aPixelIndex[_arg2][(_arg1 + 1)])].t == 5);
};
};
};
_local4 = ((_arg1 - 1) > 0);
if (_local4){
if (((!((m_aPixelIndex[_arg2][(_arg1 - 1)] == -1))) && (!(_local5)))){
if (m_objInactivePixels[("p" + m_aPixelIndex[_arg2][(_arg1 - 1)])] != undefined){
_local6 = (m_objPixelContainer[("p" + m_aPixelIndex[_arg2][(_arg1 - 1)])].t == 5);
};
};
};
_local4 = ((_arg2 + 1) < m_iHeight);
if (_local4){
if (((!((m_aPixelIndex[(_arg2 + 1)][_arg1] == -1))) && (!(_local6)))){
if (m_objInactivePixels[("p" + m_aPixelIndex[(_arg2 + 1)][_arg1])] != undefined){
_local7 = (m_objPixelContainer[("p" + m_aPixelIndex[(_arg2 + 1)][_arg1])].t == 5);
};
};
};
if (((((_local5) || (_local6))) || (_local7))){
delete m_objActivePixels[("p" + m_aPixelIndex[_arg2][_arg1])];
m_objInactivePixels[("p" + m_aPixelIndex[_arg2][_arg1])] = ("p" + m_aPixelIndex[_arg2][_arg1]);
m_objPixelContainer[("p" + m_aPixelIndex[_arg2][_arg1])].t = 5;
_local3 = false;
m_bitmapData.setPixel(_arg1, _arg2, 0xFF00);
};
return (_local3);
}
public function set spawnInt(_arg1:uint):void{
m_iSpawnInt = _arg1;
}
public function clearBitmap():void{
var _local1:uint;
var _local2:uint;
_local1 = 0;
while (_local1 < m_iHeight) {
_local2 = 0;
while (_local2 < m_iWidth) {
m_aPixelIndex[_local1][_local2] = -1;
m_aWaitIndex[_local1][_local2] = -1;
m_bitmapData.setPixel(_local2, _local1, 0);
_local2++;
};
_local1++;
};
m_objPixelContainer = new Object();
m_objActivePixels = new Object();
m_objInactivePixels = new Object();
m_iPixelCount = 0;
}
private function emptyBuffer():void{
var _local1:uint;
_local1 = 0;
while (_local1 < m_aPixelBuffer.length) {
m_objActivePixels[("p" + m_aPixelBuffer[_local1])] = m_aPixelBuffer[_local1];
_local1++;
};
m_aPixelBuffer = [];
}
public function set isPaused(_arg1:Boolean):void{
m_bPaused = _arg1;
}
public function get isPaused():Boolean{
return (m_bPaused);
}
}
}//package Classes
Section 5
//SelectList (Classes.SelectList)
package Classes {
import flash.text.*;
import flash.events.*;
import flash.display.*;
public class SelectList extends Sprite {
private var m_aElements:Array;
private var m_bCollapsed:Boolean;
private var m_objParent:Object;
private var m_tfTextFormat:TextFormat;
private var m_aSprites:Array;
private var m_iSelected:uint;
private var m_iSy:uint;
private var m_aLabels:Array;
public function SelectList(_arg1, _arg2:Array){
m_objParent = _arg1;
m_aElements = _arg2;
m_aSprites = [];
m_aLabels = [];
m_bCollapsed = true;
m_iSy = 0;
m_iSelected = 0;
m_tfTextFormat = new TextFormat();
m_tfTextFormat.font = "verdana";
m_tfTextFormat.size = 10;
m_tfTextFormat.bold = true;
m_tfTextFormat.color = 0xFFFFFF;
m_tfTextFormat.align = "center";
addEventListener(MouseEvent.MOUSE_DOWN, mouseDown_handler);
addEventListener(MouseEvent.MOUSE_MOVE, mouseMove_handler);
init();
}
private function hideList():void{
var _local1:uint;
_local1 = 0;
while (_local1 < m_aElements.length) {
if (_local1 == m_iSelected){
m_aSprites[_local1].y = (y + (_local1 * 20));
} else {
this.removeChild(m_aSprites[_local1]);
};
_local1++;
};
}
private function init():void{
var _local1:uint;
_local1 = 0;
while (_local1 < m_aElements.length) {
m_aSprites[m_aSprites.length] = new Sprite();
m_aSprites[_local1].graphics.beginFill(0xCCCCCC, 1);
m_aSprites[_local1].graphics.drawRect(0, (y - (_local1 * 20)), 100, 20);
m_aSprites[_local1].graphics.endFill();
m_aLabels[m_aLabels.length] = new TextField();
m_aLabels[_local1].x = 0;
m_aLabels[_local1].y = (y - (_local1 * 20));
m_aLabels[_local1].width = 100;
m_aLabels[_local1].height = 20;
m_aLabels[_local1].selectable = false;
m_aLabels[_local1].text = m_aElements[_local1].desc;
m_aLabels[_local1].setTextFormat(m_tfTextFormat);
m_aSprites[_local1].graphics.beginFill(m_aElements[_local1].color, 1);
m_aSprites[_local1].graphics.moveTo(5, ((y - (_local1 * 20)) + 15));
m_aSprites[_local1].graphics.lineStyle(1, 0xDDDDDD, 0);
m_aSprites[_local1].graphics.lineTo(5, ((y - (_local1 * 20)) + 15));
m_aSprites[_local1].graphics.lineTo(15, ((y - (_local1 * 20)) + 15));
m_aSprites[_local1].graphics.lineTo(10, ((y - (_local1 * 20)) + 5));
m_aSprites[_local1].graphics.endFill();
m_aSprites[_local1].addChild(m_aLabels[_local1]);
_local1++;
};
m_aSprites[m_iSelected].alpha = 0.5;
this.addChild(m_aSprites[m_iSelected]);
}
private function showList():void{
var _local1:uint;
m_aSprites[m_iSelected].y = y;
_local1 = 0;
while (_local1 < m_aElements.length) {
if (_local1 != m_iSelected){
this.addChild(m_aSprites[_local1]);
m_aSprites[_local1].alpha = 0.5;
};
_local1++;
};
}
public function mouseMove_handler(_arg1:Event):void{
var _local2:Number;
_local2 = Math.round(((this.mouseY - 10) / 20));
if (((!((m_iSy == Math.abs(_local2)))) && ((_local2 <= 0)))){
m_aSprites[m_iSy].alpha = 0.5;
m_iSy = Math.abs(_local2);
m_aSprites[m_iSy].alpha = 0.1;
};
}
private function mouseDown_handler(_arg1:Event):void{
m_bCollapsed = !(m_bCollapsed);
if (m_bCollapsed){
m_iSelected = m_iSy;
m_objParent.setBrushType(m_iSelected);
hideList();
m_aSprites[m_iSelected].alpha = 0.5;
} else {
showList();
m_aSprites[m_iSy].alpha = 0.1;
};
}
}
}//package Classes
Section 6
//Slider (Classes.Slider)
package Classes {
import flash.text.*;
import flash.display.*;
import flash.events.*;
public class Slider extends Sprite {
private var m_sFunction:String;
private var m_objParent;
private var m_tfTextFormat:TextFormat;
private var m_iCurrentX:Number;
private var m_bDrag:Boolean;
private var m_slideObject:Sprite;
private var m_sliderText:TextField;
public function Slider(_arg1, _arg2:String){
m_objParent = _arg1;
m_sFunction = _arg2;
m_iCurrentX = 1;
m_bDrag = false;
m_tfTextFormat = new TextFormat();
m_tfTextFormat.font = "verdana";
m_tfTextFormat.size = 10;
m_tfTextFormat.bold = true;
m_tfTextFormat.color = 13158;
m_tfTextFormat.align = "center";
init();
}
private function init():void{
this.graphics.beginFill(0xCCCCCC, 0.5);
this.graphics.drawRect(0, 0, 100, 5);
this.graphics.endFill();
m_slideObject = new Sprite();
m_slideObject.graphics.beginFill(0xDDDD00, 1);
m_slideObject.graphics.drawRect(0, -7.5, 20, 20);
m_slideObject.graphics.endFill();
m_slideObject.x = 0;
m_slideObject.y = 0;
m_slideObject.addEventListener(MouseEvent.MOUSE_DOWN, mouseDown_handler);
m_slideObject.addEventListener(MouseEvent.MOUSE_UP, mouseUp_handler);
m_sliderText = new TextField();
m_sliderText.x = 0;
m_sliderText.y = -4;
m_sliderText.width = 20;
m_sliderText.height = 20;
m_sliderText.selectable = false;
m_sliderText.text = String(m_iCurrentX);
m_sliderText.setTextFormat(m_tfTextFormat);
m_slideObject.addChild(m_sliderText);
this.addChild(m_slideObject);
}
private function mouseUp_handler(_arg1:Event):void{
if (m_bDrag){
m_bDrag = false;
m_slideObject.removeEventListener(Event.ENTER_FRAME, enterFrame_handler);
};
}
private function enterFrame_handler(_arg1:Event):void{
if (!((((((((this.mouseX > 4)) && ((this.mouseX < 96)))) && ((this.mouseY >= -9)))) && ((this.mouseY <= 11))))){
m_bDrag = false;
m_slideObject.removeEventListener(Event.ENTER_FRAME, enterFrame_handler);
} else {
if ((((this.mouseX >= 10)) && ((this.mouseX <= 90)))){
m_slideObject.x = (this.mouseX - 10);
};
m_iCurrentX = (1 + Math.round((m_slideObject.x / 9)));
m_sliderText.text = String(m_iCurrentX);
m_sliderText.setTextFormat(m_tfTextFormat);
var _local2 = m_objParent;
_local2[m_sFunction](uint(m_iCurrentX));
};
}
private function mouseDown_handler(_arg1:Event):void{
if (!(m_bDrag)){
m_bDrag = true;
m_slideObject.addEventListener(Event.ENTER_FRAME, enterFrame_handler);
};
}
}
}//package Classes
Section 7
//Spawn (Classes.Spawn)
package Classes {
public class Spawn {
private var delay:uint;
private var type:uint;
private var count:uint;
private var x:uint;
private var y:uint;
private var m_parent;
private var sizeX:uint;
private var sizeY:uint;
public function Spawn(_arg1, _arg2:uint, _arg3:uint, _arg4:uint, _arg5:uint, _arg6:uint=0, _arg7:uint=1){
m_parent = _arg1;
sizeX = _arg2;
sizeY = _arg3;
x = _arg4;
y = _arg5;
type = _arg6;
delay = _arg7;
count = delay;
}
public function set startDelay(_arg1:uint):void{
delay = _arg1;
}
public function get spawnDelay():uint{
return (count);
}
public function get spawnSizeX():uint{
return (sizeX);
}
public function get positionY():uint{
return (y);
}
public function set spawnSizeY(_arg1:uint):void{
sizeY = _arg1;
}
public function get spawnType():uint{
return (type);
}
public function get positionX():uint{
return (x);
}
public function set spawnDelay(_arg1:uint):void{
count = _arg1;
}
public function get startDelay():uint{
return (delay);
}
public function set positionY(_arg1:uint):void{
y = _arg1;
}
public function set positionX(_arg1:uint):void{
x = _arg1;
}
public function set spawnType(_arg1:uint):void{
type = _arg1;
}
public function set spawnSizeX(_arg1:uint):void{
sizeX = _arg1;
}
public function get spawnSizeY():uint{
return (sizeY);
}
}
}//package Classes
Section 8
//Timeline0_96615c987a86934db4b6f29dba4a34f8 (Timeline0_96615c987a86934db4b6f29dba4a34f8)
package {
import Classes.*;
import flash.display.*;
public dynamic class Timeline0_96615c987a86934db4b6f29dba4a34f8 extends MovieClip {
public var mySandBox:Sandbox;
public var myGUI:GUI;
public function Timeline0_96615c987a86934db4b6f29dba4a34f8(){
addFrameScript(0, frame1);
}
function frame1(){
stage.quality = "low";
mySandBox = new Sandbox(stage, 500, 350);
myGUI = new GUI(mySandBox);
this.addChild(mySandBox);
this.addChild(myGUI);
}
}
}//package