Skip navigation
somerset digital
Currently Being Moderated

Change mouse pointer area

Jul 12, 2012 6:12 AM

Tags: #mouse #3 #change #focus #actionscript #pointer

Hi,

 

I have had a look around and cannot find anyone who has tried to do this.

 

I have added a custom mouse pointer to my AS - its a large circle.

 

I would like to be able to alter the focus of the pointer so that the selections are made from the center of the circle rather than from the edge.

 

I cannot work out how to do this.

 

Any help would be much appreciated.

 

 

 

import flash.display.Sprite;

import flash.display.StageAlign;

import flash.display.StageScaleMode;

import flash.events.Event;

import flash.events.MouseEvent;

 

 

var myCursor:Sprite;

 

stage.align = StageAlign.TOP_LEFT;

stage.scaleMode = StageScaleMode.NO_SCALE;

 

function init()

{

          Mouse.hide();

 

          myCursor = new MyCursorClass();

          myCursor.mouseEnabled = false;

          myCursor.visible = false;

 

            addChild(myCursor);

 

          // respond to mouse move events

          stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);

          stage.addEventListener(Event.MOUSE_LEAVE, mouseLeaveHandler);

 

}

 

function mouseMoveHandler(evt:MouseEvent):void

{

          // whenever the mouse moves, place the cursor in the same spot

          myCursor.visible = true;

          myCursor.x = evt.stageX;

          myCursor.y = evt.stageY;

}

 

function mouseLeaveHandler(evt:Event):void

{

          myCursor.visible = false;

}

 

init();

 
Replies

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points