カーソルにアニメつける forked from: ネイティブマウスカーソルのテスト
// forked from undo's ネイティブマウスカーソルのテスト
package
{
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.geom.Matrix;
import flash.geom.Point;
import flash.ui.Mouse;
import flash.ui.MouseCursor;
import flash.ui.MouseCursorData;
[SWF(width="465",height="465",frameRate="30",backgroundColor="0xffffff")]
public class ASTest extends Sprite
{
public function ASTest()
{
init();
}
private function init():void
{
var cursor:Sprite = new Sprite();
cursor.graphics.lineStyle(1,0);
cursor.graphics.moveTo(0,-16);
cursor.graphics.lineTo(0,16);
cursor.graphics.moveTo(-16,0);
cursor.graphics.lineTo(16,0);
var vector:Vector.<BitmapData> = new Vector.<BitmapData>();
for(var i:int = 0; i < 10; i++)
{
var matrix:Matrix = new Matrix();
matrix.rotate(Math.PI/(2*10)*i);
matrix.tx = 16;
matrix.ty = 16;
vector[i] = new BitmapData(32,32,true,0x00000000);
vector[i].draw(cursor,matrix);
}
var cursorData:MouseCursorData = new MouseCursorData();
cursorData.hotSpot = new Point(16,16);
cursorData.data = vector;
cursorData.frameRate = 30;
Mouse.registerCursor('myCursor', cursorData);
Mouse.cursor = 'myCursor';
//stage.addEventListener(MouseEvent.CLICK, onClick);
}
private function onClick(evt:MouseEvent):void
{
//システムデフォルトに戻す場合
Mouse.cursor = MouseCursor.AUTO;
}
}
}