flash on 2009-12-6
♥0 |
Line 54 |
Modified 2009-12-31 01:08:26 |
MIT License
archived:2017-03-20 09:55:59
ActionScript3 source code
/**
* Copyright purin ( http://wonderfl.net/user/purin )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/sZvj
*/
package {
import flash.display.Sprite;
import net.hires.debug.Stats;
public class FlashTest extends Sprite {
private const BASE_Y:int = 180;
private const MAX_ARRAY:int = 8;
private var _bar:Array = [];
public function init():void{
graphics.beginFill(0xAAAAAA);
graphics.drawRect(0, 0, 470, 180);
graphics.drawRect(0, 280, 470, 190);
graphics.endFill();
barRender();
}
public function barRender():void{
for(var i:int=0;i<MAX_ARRAY;i++){
_bar[i] = new Bar(0xFF0000 >> i * 8);
if(i > 3) _bar[i].px = i * 50;
else _bar[i].px = i * 30;
_bar[i].px_end = _bar[i].px + _bar[i]._width;
_bar[i].py = BASE_Y;
}
for(i=0;i<MAX_ARRAY;i++) _bar[i].Render();
}
public function barSort():void{
}
public function FlashTest():void{
init();
for(var i:int=0;i<MAX_ARRAY;i++) addChild(_bar[i]._rect);
}
}
}
import flash.display.Sprite;
class Bar{
public var _rect:Sprite;
private var _color:int;
public var _width:int;
public var _height:int;
public var px:int;
public var px_end:int;
public var py:int;
public function Bar(col:int):void{
_rect = new Sprite();
_color = col;
_width = 100;
_height = 100;
}
public function Render():void{
_rect.graphics.clear();
_rect.graphics.beginFill(_color);
_rect.graphics.drawRect(px,py,_width,_height);
_rect.graphics.endFill();
}
}