Laggy custom cursor is Flash

Making a custom cursor in flash as3, I have replaced the cursor with a broomstick (simple vector movieclip). The code is the standard custom cursor code below:

private function listeners():void  {
    this.addEventListener(MouseEvent.MOUSE_MOVE, attachBroom);

private function attachBroom(e:MouseEvent):void 
    broomStick.x = e.stageX - 10;
    broomStick.y = e.stageY - 5;

SWF can be found here. The cursor is fine while on top of the actual smoke alarm graphic, but when it goes over the background, it lags severely when the mouse is moved at a 'fast' speed.


Try this instead of yours

private function listeners():void  {
    this.addEventListener(Event.ENTER_FRAME, attachBroom);

private function attachBroom(e:Event):void 
    broomStick.x = stage.mouseX - 10;
    broomStick.y = stage.mouseY - 5;

the logic is same but ENTER_FRAME event is faster than MOUSE_EVENTS. Also there is no updataAfterEvent for ENTER_FRAME.

There is much better way to do custom cursors nowadays.

since Flash Player 10.2, you can use the Native Cursors, which are using the native OS resources.

Need Your Help

wxPython Mac OS X Fullscreen work around error

python objective-c osx wxpython pyobjc

I was trying to get fullscreen support for a wxPython app using the code in the answer from this stackoverflow question wxPython MacOS X Lion full screen mode

Eclipse - I'm looking for View. Show me files modified today

java eclipse

I'm looking for some View in eclipse, which show me modified files by me today.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.