如何宣布事件监听器是公开的,以便所有功能都可以使用?
// 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);
}
答案 0 :(得分:0)
将嵌套事件监听器的函数转换为公共函数:
package example
{
public function addEventL()
{
/// Declares it in a function
myMovie.addEventListener(MouseEvent.CLICK, menuIn);
}
}