回転
/**
* Copyright Wataru.Miyazaki ( http://wonderfl.net/user/Wataru.Miyazaki )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/qB9q
*/
package {
import flash.display.*;
import flash.text.*;
import flash.events.*;
import flash.utils.*;
import flash.filters.*;
import com.actionscriptbible.Example;
public class ShapeRot extends Example {
private var base:Sprite;
private var rrect:Shape;
private var marker:Sprite;
private var mouseMove:Boolean;
public function ShapeRot() {
base = new Sprite();
addChild(base);
// baseに対して、四角をadd
rrect = makeRect(100, 100, 0xff0000);
rrect.x = -50;
rrect.y = -50;
base.addChild(rrect);
// baseに対して、markerをadd
marker = makeMarker(100, 100, 0xff0000);
//marker.x = -50;
//marker.y = -50;
addChild(marker);
}
//角丸矩形の生成
private function makeRect(w:uint,h:uint,color:uint):Shape {
var rrect:Shape=new Shape();
rrect.graphics.lineStyle(3,0x000000); //線幅・線色
rrect.graphics.beginFill(color); //塗り潰し色
rrect.graphics.drawRect(0,0,w,h);//XY座標,幅,高さ,角丸幅
rrect.graphics.endFill(); //塗り潰し終了
return rrect;
}
//マーカーの生成
private function makeMarker(w:uint,h:uint,color:uint):Sprite {
var rrect:Sprite=new Sprite();
rrect.graphics.lineStyle(3,0x000000); //線幅・線色
rrect.graphics.beginFill(color); //塗り潰し色
rrect.graphics.drawCircle(base.x,base.y-h/2-20,10);//XY座標,幅,高さ,角丸幅
rrect.graphics.endFill(); //塗り潰し終了
return rrect;
}
}
}