I was just curious if I add an a EventListener such as addEventListener(MouseEvent.CLICK, onClick);
Inside an ENTER_FRAME event function will it add an instance of that MouseEvent Listener every frame?
Here is my code now just wondering if this is bad practice:
addEventListener(Event.ENTER_FRAME, engineLogic);
inside my engineLogic function:
//Max objects for rock throwers on left
if (aXPositionArray.length == 0)
{
//Remove listener to add more and make button turn grey etc
rockThrowerSpawnScreen.left.removeEventListener(MouseEvent.CLICK, chooseSpawnSideRockThrowers);
rockThrowerSpawnScreen.left.visible = false;
}else
if (aXPositionArray.length != 0)
{
rockThrowerSpawnScreen.left.addEventListener(MouseEvent.CLICK, chooseSpawnSideRockThrowers);
rockThrowerSpawnScreen.left.visible = true;
trace("LISTENER");
}
or does it only add it once and checks the function every frame?