1 Reply Latest reply on Apr 15, 2007 4:26 PM by mforsberg

    Help with Undefined Error

    weegi_c
      Hi guys! I'm tearing my hair out with this one!
      Basically, I'm creating a small "Click the Country" game.
      I have 10 frames with questions on, and have created an array, which will chose the 10 questions in a random order without repeated frames.
      When the user gets the country correct, they will be taken to a "correct" screen, and the user has to click "continue". The continue button has this script;

      on (release) {
      _root.gotoAndPlay (randArray[frame]);
      //testing purposes:
      trace (randArray[frame]);
      frame++;
      }

      When clicked, it comes up as undefined. I think it may be something to do with the randArray. I've attached the script from the main timeline
      Can anybody see where I'm going wrong here?
      Thanks


        • 1. Re: Help with Undefined Error
          mforsberg
          Seems like a scoping issue in the code in your button. it's simply looking for the variable randArray and frame in itself. I'm guessing that's not where it is? If those variables are also members of _root:

          on (release) {
          _root.gotoAndPlay (_root.randArray[_root.frame]);
          //testing purposes:
          trace (_root.randArray[_root.frame]);
          _root.frame++;
          }