-
Custom cursors
I have added a custom cursor to my application, using the following code:
Code:
Mouse.hide();
mouseEnabled = false;
stage.addEventListener(MouseEvent.MOUSE_MOVE,follow);
function follow(evt:MouseEvent)
{
cursor.x = mouseX;
cursor.y = mouseY;
}
However it does not stay on top of the scene because new objects are created during the application run, and the cursor goes behind them as it is an older object. I want the cursor to stay on top at all times... How can I do this?
-
Flash/Flex Developer
You have to update it index as a new displayobject is added.
stage.setChildIndex(cursor, stage.numChildren - 1);
Or you can have it update it when it moves.
Some people are like Slinkies, not really good for anything, but they bring a smile to your face when pushed down the stairs.
-
I copied that code in the "follow" function but it tells me:
"The supplied DisplayObject must be a child of the caller"
-
Dignitary
Use this:
Code:
if(getChildIndex(cursor) != numChildren-1){
setChildIndex(cursor, numChildren-1);
}
Last edited by rynoe; 06-08-2012 at 09:50 AM.
Reason: Locusts
[SIGPIC][/SIGPIC]
-
That does make the cursor go on top, but unfortunately it makes the program no longer react when I click on objects.
I've read somewhere that the image of a custom cursor can get in the way, but that mouseEnabled = false; is supposed to fix that. But it doesn't. I'm not sure what the problem is.
-
-
Dignitary
Within the custom cursor, move the graghic just off the anchor point.
-
maybe you should be doing
cursor.mouseEnabled = false;
If cursor is inside another movie clip, make it so its highest-level parent is mouse disabled too. The graphical-moving thing is more of a workaround than a true solution, but It should work too.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|