/**
* Copyright _ueueueueue ( http://wonderfl.net/user/_ueueueueue )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/aVYj
*/
package
{
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.text.*;
import flash.ui.*;
[SWF(backgroundColor=0xFFFFFF,width=465,height=465,frameRate=60)]
/**
* ...
* @author ue
*/
public class Main extends Sprite
{
private var points:Vector.<Point>;
private var cursor:Cursor;
public function Main():void
{
init();
}
private function init():void
{
stage.showDefaultContextMenu = false;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;;
Mouse.hide();
points = new Vector.<Point>();
points.push(
new Point(0,0),
new Point(1,0),
new Point(2,1),
new Point(3,2),
new Point(4,3),
new Point(5,4),
new Point(6,5),
new Point(7,6),
new Point(8,7),
new Point(9,8),
new Point(10,9),
new Point(11, 10),
new Point(10,10),
new Point(9,10),
new Point(8,10),
new Point(7,10),
new Point(7,11),
new Point(7,12),
new Point(8,13),
new Point(8,14),
new Point(9,15),
new Point(9,16),
new Point(10,17),
new Point(10,18),
new Point(9,19),
new Point(8,19),
new Point(7,18),
new Point(7,17),
new Point(6,16),
new Point(6,15),
new Point(5,14),
new Point(5,13),
new Point(4,12),
new Point(4,11),
new Point(3,12),
new Point(2,13),
new Point(1,14),
new Point(0,15),
new Point(0,14),
new Point(0,13),
new Point(0,12),
new Point(0,11),
new Point(0,10),
new Point(0,9),
new Point(0,8),
new Point(0,7),
new Point(0,6),
new Point(0,5),
new Point(0,4),
new Point(0,3),
new Point(0,2),
new Point(0,1)
);
cursor = new Cursor(12, 20, points, 0x0);
addChild(cursor);
addEventListener(Event.ENTER_FRAME, update);
stage.addEventListener(Event.MOUSE_LEAVE, leaveStage);
}
private function update(e:Event):void
{
cursor.x = mouseX;
cursor.y = mouseY;
}
private function leaveStage(e:Event):void
{
stage.removeEventListener(Event.MOUSE_LEAVE, leaveStage);
stage.addEventListener(MouseEvent.MOUSE_MOVE, enterStage);
cursor.visible = false;
cursor.scaleX=cursor.scaleY+=0.5;
}
private function enterStage(e:Event):void
{
stage.addEventListener(Event.MOUSE_LEAVE, leaveStage);
stage.removeEventListener(MouseEvent.MOUSE_MOVE, enterStage);
cursor.visible = true;
}
}
}
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Sprite;
import flash.geom.Point;
class Cursor extends Sprite
{
private var bmd:BitmapData;
public function Cursor(width:Number,height:Number,vector:Vector.<Point>,color:uint=0x0)
{
bmd = new BitmapData(width, height, true, 0xFFFFFFFF);
pixelDraw(bmd, vector);
addChild(new Bitmap(bmd));
}
private function pixelDraw(bitmapData:BitmapData, vector:Vector.<Point> = null, color:uint = 0x0):void
{
var n:int = vector.length;
while (n--)
{
bitmapData.setPixel(vector[n].x, vector[n].y, color);
}
}
}