forked from: forked from: クラス定義の練習 其の参
FuncRotateクラスはいらなかったような…気がしたので
...
@author I am Afro Boy ヾ(。`Д´。)ノ
/**
* Copyright argon ( http://wonderfl.net/user/argon )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/thb0
*/
// forked from AfroBoy's forked from: クラス定義の練習 其の参
// forked from AfroBoy's クラス定義の練習 其の参
// FuncRotateクラスはいらなかったような…気がしたので
package
{
import flash.display.Sprite;
import flash.events.Event;
/**
* ...
* @author I am Afro Boy ヾ(。`Д´。)ノ
*/
public class Main extends Sprite
{
private var sp:AddRect;
private const KOSU:int=1500;
public function Main():void
{
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e:Event = null):void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
// entry point
for (var i:int = 0; i < KOSU; i++)
{
sp = new AddRect();
sp.x = stage.stageWidth * Math.random();
sp.y = stage.stageHeight * Math.random();
addChild(sp);
sp.scaleX = sp.scaleY = 1 + Math.random() * 2;
}
}
}
}
import flash.display.Sprite;
import flash.events.Event;
class AddRect extends Sprite
{
private var randomNum:Number=5+Math.random()*7;
public function AddRect()
{
graphics.beginFill(Math.random() * 0xffffff);
graphics.drawRect(0, 0, randomNum, randomNum);
graphics.endFill();
addEventListener(Event.ENTER_FRAME, onEnterFrameHandler);
}
private function onEnterFrameHandler(e:Event):void
{
rotation += .5;
}
}
/* import flash.display.Sprite;
import flash.events.Event;
import flash.geom.Point;
class FuncRotate extends Sprite
{
private var rotateSP:AddRect;
function FuncRotate(num:uint, leng:uint )
{
var rad:Number = 2 * Math.PI / num;
for (var i:int = 0; i < num; i++)
{
rotateSP = new AddRect();
var pt:Point = Point.polar(leng, rad*i);
rotateSP.x = pt.x;
rotateSP.y = pt.y;
addChild(rotateSP);
}
}
}*/