Copy link to clipboard
Copied
So I have a project where I control which frame I go to by moving my mouse around. I also have a counter which I want to increase when I reach a certain frame.
Here's the code on the first frame for the counter.
var Count:Number = 0;
stage.addEventListener(Event.ENTER_FRAME,enterEachFrame);
function enterEachFrame(e:Event):void
{
if (Counter_txt.text >= (8).toString())
{
gotoAndStop(1,"Scene 7");
}
}
And here's the code I've been trying to put at the frames to add to the counter, this is where I'm running into the problem.
trace("3");
Count = Count + 1;
Counter_txt.text = (Count).toString();
}
Copy link to clipboard
Copied
the problem's in frame 1.
use:
var Count:Number = 0;
stage.addEventListener(Event.ENTER_FRAME,enterEachFrame);
function enterEachFrame(e:Event):void
{
if (Counter>= 8)
{
gotoAndStop(1,"Scene 7");
}
}
Find more inspiration, events, and resources on the new Adobe Community
Explore Now