Jump to content
  • Advertisement
Sign in to follow this  

Unity AS3: Custom native cursor [Flash CS4]

This topic is 1278 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm currently developing a flash game using Adobe Flash CS4 Professional and AS3. I have a custom cursor set up in my game, but it only changes position when the game renders a frame, 30 times per second, which could be better, so i want a custom native cursor.

Custom native cursor is a feature of Flash Player 10.2+, but in Flash CS4 i can only publish as Flash Player 10, and i can't have a custom native cursor.


I've added a new playerglobal.swc and a new flash player configuration, by using this tutorial: http://blogs.adobe.com/rgalvan/2011/11/adding-fp11-support-to-flash-pro-cs5-and-cs5-5.html, so now i can publish as Flash Player 10.2 or later versions, but i can't get the custom native cursor feature to work. I get the following error: VerifyError: Error #1014: Class flash.ui::MouseCursorData could not be found. How can i make the flash.ui.MouseCursorData class work with Flash Pro CS4?


Here is my code:

var bitmapDatas:Vector.<BitmapData> = new Vector.<BitmapData>(1, true);
var bitmapData:BitmapData = new CustomCursor(32,32);
bitmapDatas[0] = bitmapData;

var cursorData:MouseCursorData = new MouseCursorData();
cursorData.hotSpot = new Point(0,0);
cursorData.data = bitmapDatas;

Mouse.registerCursor("MyCursor", cursorData);

Mouse.cursor = "MyCursor";

The following is imported to make it work:

import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.InteractiveObject;
import flash.events.MouseEvent;
import flash.geom.Point;
import flash.ui.Mouse;
import flash.ui.MouseCursor;
import flash.ui.MouseCursorData;

The "MouseCursorData" part of the line: "import flash.ui.MouseCursorData;" does however stay black, whereas the other lines are blue, indicating that they are functioning.


So how do i add a custom native cursor to my game? Any workarounds/hacks appreciated.

I wont be buying a later version of Flash since this will probably by my last Flash game, as i will start to use Unity3D.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!