Problem with EventListener 'tick'
I am trying to move an object (a movie clip called "m_bubble") across the screen using the EventListener tick. I need to turn on and turn off the movement so I have 'nested' the tick code inside a click EventListener (controlled by "b_button"):
var instructioncount = 0;
this.b_button.addEventListener("click", ct1.bind(this));
function ct1()
{
instructioncount += 1;
stage.addEventListener("tick", moveIt.bind(this));
function moveIt()
{
if(instructioncount == 2){this.m_bubble.x -= 1;}
if(instructioncount == 3){this.m_bubble.x -= 1;}
if(instructioncount == 4){this.m_bubble.x -= 1;}
if(instructioncount == 5){this.m_bubble.x -= 1;}
if(instructioncount == 6){stage.removeEventListener("tick", moveIt.bind(this));}
}
}
So it works, but here's the problem. When I click the button more than once the bubbles move faster and it doesn't appear predictable, even though the parameters are the same. As I recall, the good old 'enter_frame" in ActionScript didn't do this.
Why does Flash have to die - couldn't they just leave it for the educators in this world?
