actionscript 3 - Getting Mouse Position on Event -


i have 2 events; mouse , down. initial position of mouse when left button down. plan last position of mouse when button released. if there horizontal movement can recognise. problematic. since add listener movie clip, obtain mouse x in bounds of movie clip. mean if release button outside of movie clip not work because event attached it. there turnarounds here?

m_c.addeventlistener(mouseevent.mouse_down, startpoint); m_c.addeventlistener(mouseevent.mouse_up, endpoint); 

function startpoint(event:mouseevent):void {     initx = stage.mousex; } 

function endpoint(event:mouseevent):void {     lastx = stage.mousex;     trace("drop ", lastx);     if(lastx < initx)     {         trace("goes left");         .         .         .      } } 

you need addlistener stage, preferable in listener of mouse_down

function startpoint(event: mouseevent) : void {     stage.addeventlistener(mouseevent.mouse_up, endpoint);      // code } 

Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -