flash on 2012-11-28
♥0 |
Line 82 |
Modified 2012-11-28 02:40:29 |
MIT License
archived:2017-03-30 08:28:06
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/wg5W
*/
package
{
import flash.display.*;
import flash.events.*;
import flash.geom.*;
public class Main extends Sprite
{
public function Main()
{
addEventListener(Event.ADDED_TO_STAGE, addedToStage);
}
public function _init() :void
{
addChild(new Item(0, 0, 0, 0));
graphics.clear ();
graphics.lineStyle (1, 0, 0.75);
graphics.drawRect (0, 0, 464, 464);
}
public function addedToStage($e:Event) :void
{
removeEventListener(Event.ADDED_TO_STAGE, addedToStage);
_init();
}
}
}
import flash.display.*;
import flash.events.*;
import flash.geom.*;
class Item extends Sprite
{
protected var _x:Number;
protected var _y:Number;
protected var _w:Number;
protected var _h:Number;
protected var _b:Boolean;
public function Item($x:Number, $y:Number, $w:Number, $h:Number)
{
addEventListener(Event.ADDED_TO_STAGE, addedToStage);
_x = $x;
_y = $y;
_w = $w;
_h = $h;
}
public function _init() :void
{
graphics.clear ();
graphics.lineStyle (1, 0, 0.75);
graphics.beginFill (1, 0.5);
graphics.drawRect (_x, _y, _w, _h);
graphics.endFill ();
}
public function addedToStage($e:Event) :void
{
removeEventListener(Event.ADDED_TO_STAGE, addedToStage);
_init();
}
public function onMouseDown($e:MouseEvent) :void
{
}
public function onEnterFrame($e:Event) :void
{
if (state)
{
!state;
if (width < 100)
{
width ++;
height ++;
}
}
}
public function get state () :Boolean { return _b }
public function set state ($n:Boolean) :void { _b = $n; _init(); }
public override function get x () :Number { return _x }
public override function get y () :Number { return _y }
public override function get width () :Number { return _w }
public override function get height () :Number { return _h }
public override function set x ($n:Number) :void { _x = $n; _init(); }
public override function set y ($n:Number) :void { _y = $n; _init(); }
public override function set width ($n:Number) :void { _w = $n; _init(); }
public override function set height ($n:Number) :void { _h = $n; _init(); }
}