A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Key Validation

  1. #1
    Member
    Join Date
    May 2005
    Location
    San Francisco
    Posts
    55

    Key Validation

    Hi,
    I'm trying to attach a key validator, that where unless a file called .key.txt contains a valid string, the timeline will goto a certain frame called stolen.

    i have this in .key.txt

    Key=valid

    and here is my actionscript:

    this.createEmptyMovieClip("some_mc", 1);
    some_mc.loadVariables("key.txt");
    some_mc.onEnterFrame = function() {
    if (this.Key == "valid") {
    _root.movie.gotoAndStop("home");
    } else {
    if (this.Key != "valid") {
    _root.movie.gotoAndStop("stolen");
    }
    }
    }

    stop();

    It works, but i keep seeing the account suspended page popup on start. I dont understand why, i have it on frame 10 of a movie. all the preceding frames have stop actions. frame 1 of movie is "home".
    Last edited by paragonc; 09-29-2006 at 06:30 PM.

  2. #2
    Member
    Join Date
    May 2005
    Location
    San Francisco
    Posts
    55
    actually it doesnt work - now the rest of my links all go back to home...

  3. #3
    Member
    Join Date
    Apr 2003
    Location
    Singapore
    Posts
    74
    Key=valid
    is
    Key="valid"

    might this be the problem? Or maybe the problem could be that you're using the same variable name as the Key class in flash?

    Btw, since you're using onEnterFrame on what appears to be the _root level, if Key=="valid", your root.movie.gotoAndStop("home"); will execute endlessly whenever it has a chance. Maybe that's why your movie keeps going back to "home"? Try changing it to onLoad() instead.
    My DeviantART gallery of drawings and games.

  4. #4
    Member
    Join Date
    May 2005
    Location
    San Francisco
    Posts
    55
    i changed it to:

    this.createEmptyMovieClip("some_mc", 1);
    some_mc.loadVariables("key.txt");
    some_mc.onLoad = function() {
    if (this.Key == "valid") {
    _root.movie.gotoAndStop("home");
    } else {
    if (this.Key != "valid") {
    _root.movie.gotoAndStop("stolen");
    }
    }
    }

    and it just hangs on the blank page. I have the entire site in a movie called Primary. On frame 1 of the _root timeline. The first frame of the movie clip is blanl, but cuttons the code above.

  5. #5
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    Key is a reserved word, change it to avoid confusion in Flash
    Code:
    // text file - &aKey=valid&
    
    // Flash - frame#1 -
    lv = new LoadVars();
    lv.onLoad = function(){
    isValid = lv.aKey;  trace(isValid);
    if(isValid == "valid"){
    _root.movie.gotoAndStop("home");
    } else {
    _root.movie.gotoAndStop("stolen");
    }
    };
    lv.load("key.txt");

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center