Is there a way to update a function?
My Main function declares a var, but when the var changes on another function, it stays the same in the Main function. I guess it’s because the function is called once, right?
example:
public function Main()
{
level = 1;
addEventListener.(TimerEvent.TIMER, timerGame);
}
function timerGame(event:TimerEvent)
{
if (somethingHappens)
{
level = 2;
trace("NEXT LEVEL!");
}
}
The code is just a simple example of the problem I’m having.
It works to a point that it traces level equaling 2, but the Main function is the one that creates the level. It still thinks level = 1 when “something happens.”