[CS3, AS2] gotoAndStop (variable); Not Working

Hello,

I’m using variables for the first time, and I didn’t know if I’m trying something that doesn’t work or what but here’s my problem (bear in mind this is only the test program, not the full project I’m attempting);

I have a simple 3 frame file.
Frame 1 (main code, aka: the problem area)
Frame 2 (gotoAndPlay (1):wink:
Frame 3 (Content Frame, aka: destination)

The concepts I’m trying to understand are two-fold: Creating Variable, and Loading them externally.

Here’s my code:

var varFrame: Number;
var my_lv:LoadVars = new LoadVars();

my_lv.load ("external_code.txt");


my_lv.onLoad = function(success:Boolean):Void {
    if (success) {
        trace(this.varFrame); // Number from external file.
    } else {
        trace("Error");
    }
}
this.gotoAndStop(varFrame);

and my external TXT file contains the Variable Value

&varFrame=3

I can get the project to return the number “3” to the output window, but I can’t get gotoAndStop (varFrame); to work.

Please help!

I understand this is a pointless program, but the project I’m building for work uses all these same lines of code (almost).

Thanks in advance,

Trouble (aka: Jeff)