Quantcast
Viewing all articles
Browse latest Browse all 13519

How to let the label move and follow the cursor?

I tried with following code, but it didn't work well. Please advise, thanks.

 

btn_chimg.addEventListener(MouseEvent.MOUSE_OUT, outofme);

btn_chimg.addEventListener(MouseEvent.MOUSE_MOVE, moveme);

 

function moveme(event:Event):void {

     trace("moveme");

     lab1.text = "Hi, Im here.";

     lab1.visible = true;

     lab1.x = mouseX;

     lab1.y = mouseY;

}

 

function outofme(e:Event):void {

     trace("outofme");

     lab1.visible = false;

}


Viewing all articles
Browse latest Browse all 13519

Trending Articles