Apollo Cybernetics
-framework
-unmerged
♥0 |
Line 117 |
Modified 2013-03-13 07:52:35 |
MIT License
archived:2017-03-20 11:41:15
ActionScript3 source code
/**
* Copyright hemingway ( http://wonderfl.net/user/hemingway )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/sTaZ
*/
package
{
import flash.display.*;
import flash.events.*;
[SWF(frameRate=60, width=465, height=465)]
public class Main extends Sprite
{
public var _buffer :Buffer;
public function Main()
{
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
_buffer = new Buffer();
Constants.flashStage = this.stage;
addEventListener(Event.ADDED_TO_STAGE, addedToStage);
}
public function addedToStage($e:*) :void
{
removeEventListener(Event.ADDED_TO_STAGE, addedToStage);
addChild(_buffer);
}
}
}
import flash.display.*;
import flash.events.*;
class Constants
{
public static var flashStage :Stage;
}
class Buffer extends Sprite
{
private var _container :Container;
public function Buffer()
{
_container = new Container();
addEventListener(Event.ADDED_TO_STAGE, addedToStage);
}
public function addedToStage($e:*) :void
{
removeEventListener(Event.ADDED_TO_STAGE, addedToStage);
addChild(_container);
}
}
class Container extends Sprite
{
private var _apollo :Apollo;
public function Container()
{
_apollo = new Apollo(465/2, 465/2);
addEventListener(Event.ADDED_TO_STAGE, addedToStage);
}
public function addedToStage($e:*) :void
{
removeEventListener(Event.ADDED_TO_STAGE, addedToStage);
addChild(_apollo);
init();
}
public function init() :void
{
graphics.clear();
graphics.beginFill(0xCCCCCC);
graphics.drawRect(0, 0, Constants.flashStage.stageWidth, Constants.flashStage.stageHeight);
graphics.endFill();
}
}
class Apollo extends Sprite
{
protected var _x :int;
protected var _y :int;
protected var _command :String;
protected var _commandList :Array;
public function Apollo($x:int, $y:int)
{
_x = $x;
_y = $y;
_command = "";
_commandList = ["traverse", "expand", "contract"];
addEventListener(Event.ADDED_TO_STAGE, addedToStage);
}
public function addedToStage($e:*) :void
{
removeEventListener(Event.ADDED_TO_STAGE, addedToStage);
init();
}
public function init() :void
{
graphics.clear();
graphics.lineStyle(1);
graphics.drawCircle(_x, _y, 10);
}
public function parseCommands($:String) :void
{
switch(_command)
{
case "traverse":
x++;
break;
case "expand":
width++;
break;
case "contract":
width--;
break;
}
}
public function absoluteRuleset($:String) :void
{
}
public override function get x() :Number
{return _x}
public override function get y() :Number
{return _y}
public override function set x($:Number) :void
{_x = $; init()}
public override function set y($:Number) :void
{_y = $; init()}
}