I've just created a simple password system using numbers. All you need to do is put the password into an array in TEXT FORM, so the password 1337 would become:
var aPassW:Array = ["one", "three", "three", "seven"]; //the password can be as long as you want, and you can use any number from 0-9.
Then my custom class which I created called NumberString will convert the array to a string that will contain the words in numerical form ("1337") and then the password is checked by converting the password string and the inputted password back into text and checking if they are equal :)
I did it just now because I was bored, and I kinda like it =P Simple to use, here is an example of it, you may have to right click and save as. The password is 15937.
This is how you use it:
var aPassW:Array = ["one", "five", "nine", "three", "seven"];
//aPassW is the password, remember TEXT FORM as shown
var secret:String = NumberString.convertArrTo(aPassW);
cont.onPress = function() {
//"cont" is the instance name of the password button
//"pswrd" is the instance name of the password text box.
if (NumberString.convertNumTo(pswrd.text) == NumberString.convertNumTo(secret)) {
//actions to do if password is correct
} else {
//actions to do if password is incorrect
}
};
And here is the class, to be saved as an .as file in the same directory of the .fla or in one of your class directorys.
class NumberString {
static var topNum:Number = 41;
static function convertTo(str:String):Number {
var numTexts:Array = ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen", "twenty", "twenty-one", "twenty-two", "twenty-three", "twenty-four", "twenty-five", "twenty-six", "twenty-seven", "twenty-eight", "twenty-nine", "thirty", "thirty-one", "thirty-two", "thirty-three", "thirty-four", "thirty-five", "thirty-six", "thirty-seven", "thirty-eight", "thirty-nine", "fourty"];
var numNums:Array = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40];
for (var a = 0; a<41; a++) {
if (str == numTexts[a]) {
return numNums[a];
}
}
return 0;
}
static function convertFrom(num:Number):String {
var numTexts:Array = ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen", "twenty", "twenty-one", "twenty-two", "twenty-three", "twenty-four", "twenty-five", "twenty-six", "twenty-seven", "twenty-eight", "twenty-nine", "thirty", "thirty-one", "thirty-two", "thirty-three", "thirty-four", "thirty-five", "thirty-six", "thirty-seven", "thirty-eight", "thirty-nine", "fourty"];
var numNums:Array = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40];
for (var a = 0; a<41; a++) {
if (num == numNums[a]) {
return numTexts[a];
}
}
return "NaN";
}
static function convertArrTo(arr:Array):String {
var coll:String = "";
for (var a = 0; a<arr.length; a++) {
coll += (convertTo(arr[a])).toString();
}
return coll;
}
static function toArray(str:String):Array {
var arr:Array = [];
for (var a = 0; a<str.length; a++) {
arr.push(str.charAt(a));
}
return arr;
}
static function convertNumTo(str:String):String {
var b:String = "";
var str2 = toArray(str.toString());
for (var a = 0; a<str2.length; a++) {
b += convertFrom((str2[a]));
}
return b;
}
}
Some of that isn't needed, but I didnd't make the class (which is unfinished) specifically for this.