Removing EventListeners in Actionscript 3 -


i have function in want remove eventlistener, gives me following error:

access of undefined property event 

here code in question:

dr_line.addeventlistener(mouseevent.click,drawln); var test:boolean;  function drawln(e:mouseevent):void{     event.currenttarget.removeeventlistener(mouseevent.click, drawln);     stage.addeventlistener(mouseevent.click,click1);     }  var sx,sy,fx,fy,j:int;  function click1(e:mouseevent):void{     sx=mousex;     sy=mousey;     stage.addeventlistener(mouseevent.click,click2); }  function click2(e:mouseevent):void{     var i:int;     i=1;     trace(i);     fx=mousex;     fy=mousey;     var  line:shape = new shape();     line.graphics.beginfill(0x00ff00);     line.graphics.moveto(sx,sy);     line.graphics.lineto(fx,fy);     this.addchild(line); } 

i tried doing same removal of event listener in click1 , click2, still doesn`t work.

what doing wrong?

event not declared; e is. try changing this:

function drawln(e:mouseevent):void{     event.currenttarget.removeeventlistener(mouseevent.click, drawln);     stage.addeventlistener(mouseevent.click,click1);     } 

to this:

function drawln(e:mouseevent):void{     e.currenttarget.removeeventlistener(mouseevent.click, drawln);     stage.addeventlistener(mouseevent.click,click1);     } 

or possibly this:

function drawln(e:mouseevent):void{     dr_line.removeeventlistener(mouseevent.click, drawln);     stage.addeventlistener(mouseevent.click,click1);     } 

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -