AS3 Movieclip always on top!

Hey!

I’ve been trying a while now making a cursor in AS3 that stays on top all the time… But it’s hard…

cursor = the cursor MovieClip.


Mouse.hide();

cursor.addEventListener(Event.ENTER_FRAME, cursorEvent);

function cursorEvent(e:Event) {
    cursor.x = mouseX;
    cursor.y = mouseY;
}

I’ve seen some places that it’s easy, just to add “setChildIndex()”.
But i’ve not gotten it to work properly.

This is what i’ve tried :


Mouse.hide();

cursor.setChildIndex(cursor, 9999)

cursor.addEventListener(Event.ENTER_FRAME, cursorEvent);

function cursorEvent(e:Event) {
    cursor.x = mouseX;
    cursor.y = mouseY;
}

and


Mouse.hide();

this.setChildIndex(cursor, 9999)

cursor.addEventListener(Event.ENTER_FRAME, cursorEvent);

function cursorEvent(e:Event) {
    cursor.x = mouseX;
    cursor.y = mouseY;
}

And i’ve tried stage instead of cursor and this too…

What am I doing wrong?

Cheers,
Artheus