justnajm
justnajm

Reputation: 4534

AS3 How to set cursor property move

I am unable to set my flash cursor from auto to move, any help ?

private function itemCursorMove(e:MouseEvent){

Mouse.cursor = "move";

e.currentTarget.addEventListener(MouseEvent.MOUSE_OUT,itemCursorAuto);

}

Upvotes: 0

Views: 341

Answers (1)

Vesper
Vesper

Reputation: 18747

You have to manually registerCursor() a "move" cursor. In order to register a new mouse cursor, you need to have:

  1. A vector of bitmap images that contain cursor shapes. Can have a length of 1, with a single shape. Maximal bitmap size is 32x32.
  2. A defined hotspot (the point which actually interacts with environment), you manually define it basing on your images.
  3. A combined MouseCursorData object, filled with this data. Description here. You just create it, fill its properties and pass it to...
  4. A Mouse.registerCursor() call. The manual is here. In short, you provide it a String that will be the name of the cursor, and a prepared object.

This is only needed to be done once at initialization. An example:

var mcd:MouseCursorData=new MouseCursorData();
mcd.data=Vector.<BitmapData>([new MyCursorImage().bitmapData]); // a single image
// MyCursorImage is an asset of type Bitmap
mcd.hotSpot=new Point(); // top left corner is action point
Mouse.registerCursor("move",mcd);

Upvotes: 1

Related Questions