flash on 2010-4-20
/**
* Copyright 9re ( http://wonderfl.net/user/9re )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/eXX8
*/
// forked from 9re's flash on 2010-4-20
package {
import flash.display.Sprite;
import flash.display.MovieClip;
import flash.events.Event;
public class FlashTest extends Sprite {
public function FlashTest() {
// write as3 code here..
var rot:int = 0;
var mc:MovieClip;
with (mc = new MovieClip) {
x = y = 465>>1;
with(mc.graphics) {
clear();
lineStyle(1);
drawRect(-100,-50,200,100);
}}
addEventListener(Event.ENTER_FRAME, function ():void {
var nW:Number;
var nH:Number;
rot++;
with(mc) {
sW=200;sH=100;
sR=Math.PI/180*(rot);
nW = Math.max(
Math.abs(sW * Math.cos(sR) - sH * Math.sin(sR)),
Math.abs(sW * Math.cos(sR) + sH * Math.sin(sR))
);
nH = Math.max(
Math.abs(sW * Math.sin(sR) + sH * Math.cos(sR)),
Math.abs(sW * Math.sin(sR) - sH * Math.cos(sR))
);
rotation = rot;
}
addChild(mc);
graphics.clear();
graphics.lineStyle(1, 0xff<<16);
graphics.drawRect(mc.x - nW/2, mc.y - nH/2, nW, nH);
});
}
}
}