4 Replies Latest reply on Feb 21, 2008 9:17 AM by adam@blueapplestudio

    Looping in a frame, need code to execute once.

    adam@blueapplestudio Level 1
      In the movie there are two scripts.
      1)Lingo Movie script that defines a simple loop function
      2)JavaScript Behavior script that is placed on frame 10, and doing the bulk of the work.

      I would like to loop inside of frame 10, but only execute the fTraceTest function once. Now, my attached code works, but I want to change the variable i to something more meaningful (ex: bTraceTestHasRun.) It seems that if I change the i variable to anything else, I get an error stating that it is undefined. In ActionScript I would check to see if a variable is undefined, and if it was, then I would assign it a value. This doesn’t seem to work here. Two questions:

      1)Why does i not return the “undefined” error and everything else I try (bTraceTestHasRun, k, etc.) seems to?
      2)Is there a way I can check to see if a variable is undefined, and if it is, assign it a value?