ActionScript 3.0 using closures for event handlers

前端 未结 9 2054
挽巷
挽巷 2020-12-28 18:35

I tried doing this:

root.addEventListener(\"click\", 
   function () 
   { 
      navigateToURL(ClickURLRequest,\"_self\"); 
   });

And it

9条回答
  •  死守一世寂寞
    2020-12-28 19:36

    I dont know what you're actually doing but in this particular example perhaps you could have a _clickEnabled global variable.

    Then inside the event handler you just check _clickEnabled, and if its false you just return immediately.

    Then you can enable and disable the overall event without detaching and reattaching it.

提交回复
热议问题