1 Reply Latest reply on Sep 10, 2006 8:23 AM by scsherwood

    relation of frame1 and frame 3

    ahmultHoAngel Level 1
      In frame 1, I use sth like this script
      function makeMove(myScore, yourScore){
      // Have a shoot
      if(turn == "C"){
      myScore += 5;
      //doSend(myScore, yourScore)
      } else {
      yourScore +=5;
      //doSend(myScore, yourScore)
      }
      }

      in frame 3, I use this for my button
      on(press){
      makeMove(11, 3)
      }

      but the variable doesnt pass to frame 1.
      Do anyone have any ideas how to work it out?
        • 1. Re: relation of frame1 and frame 3
          scsherwood Level 1
          If you are referring to the variables "myScore" and "yourScore," you have a scope problem. The scope of the variables are defined, as far as I can see, local to the function, which means once the function is finished executing, the variables are destroyed. If you want the variables to be global, define them on frame 1 of the main timeline with the _global keyword as follows:

          _global.myScore:Number;
          _global.yourScore:Number;

          Try that.