Mouse position.
Assigning a Custom cursor

Setting a custom cursor

You need a custom cursor when you need to give your cursor a different look, mostly to make it look bigger or to make it match the style of your game.
You cannot change the computer cursor but you can make it" dissapear" and then replace it with a sprite that matches the cursor location and that" floats" above everything else.

1. To make the mouse dissapear use the command

Mouse . hide () ;
flash term for mouse
. method ;

 

 

2. To have a sprite act as a cursor, make a movieclip with one frame, name it in the properties panel and place it on frame 1 of the timeline on a layer above anything else
(except the actions placed in the ACTIONS layer).
If you are creating objects with AS you can use the command getChildIndex to place the sprite-cursor at the top after you have created your game objects.

3. To make the sprite follow the cursor we need an ENTER FRAME listener, we will assign a function (called moveCursor) Than will assign the x and y position of the cursor to our sprite-movieclip (called arrow_mc):

addEventListener ( Event . ENTER_FRAME , moveCursor ) ;
  ( Event . event type , function name ) ;

 

function moveCursor ( Event . Event ) {  
  function name (   . type ) {  
  arrow_mc . x = mouseX ) ;  
  mc name . x =   ) ;  

 

  arrow_mc . y = mouseY ) ;
  mc name . y =   ) ;


l

Mouse . hide ();