0

如何将事件侦听器声明为公共的,以便所有功能都可以使用它?

// Coded needed below to declare Event

function addEventL()
   {
   /// Declares it in a function
   myMovie.addEventListener(MouseEvent.CLICK, menuIn);
   }

function removeEventL()
   {
   /// This does not work because it was first called in a function.
   /// So it can not find the event Listener to remove.  
   myMovie.removeEventListener(MouseEvent.CLICK, menuIn);
   }
4

1 回答 1

0

将嵌套事件侦听器的函数转换为公共函数:

package example
{ 
 public function addEventL()
 {
 /// Declares it in a function
 myMovie.addEventListener(MouseEvent.CLICK, menuIn);
 }
}
于 2013-05-16T23:23:40.820 回答