-
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".
-
actually it doesnt work - now the rest of my links all go back to home...
-
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.
-
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.
-
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");