Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

add to counter when reaching a certain frame

New Here ,
Feb 11, 2018 Feb 11, 2018

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();

    }

TOPICS
ActionScript
220
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 11, 2018 Feb 11, 2018
LATEST

the problem's in frame 1.

use:

user

        var Count:Number = 0;

        stage.addEventListener(Event.ENTER_FRAME,enterEachFrame);

        function enterEachFrame(e:Event):void

        {

   

        if (Counter>= 8)

                {

                        gotoAndStop(1,"Scene 7");

                }

        }  

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines