PDA

View Full Version : Random Number cycling


BGTwitch
01-27-2005, 11:50 PM
hello,

i want my effect to cycle through numbers until it hits the right one, like so:
(the numbers 36987 should appear) * = random number

*****
3****
36***
369**

etc until it reaches the correct numbers.

But of course being the actionscript n00b that i am, i have no idea how to do so. :o

Also, is there a way i could make it search more numbers or do something in general to slow the process down?

Any help would be greatly appreciated. :)

Xeef
01-28-2005, 03:29 PM
hi and welcome to As.Org

Secret = "abc123ABCxyz456XYZ890";
_root.createTextField("Secret_txt", 1, 100, 100, 0, 0);
Secret_txt.autoSize = true;
Secret_txt.text = Secret;
_root.createTextField("Search_txt", 2, 100, 150, 0, 0);
Search_txt.autoSize = true;
//Search_txt.text = Secret;
Count = 0;
Curent = "";
onEnterFrame = function () {
RandomChar = chr(random(75)+48);
Search_txt.text = Curent+RandomChar;
if (Secret.charAt(Count) == RandomChar) {
Curent += RandomChar;
Count++;
}
if (Curent == Secret) {
delete onEnterFrame;
}
};

BGTwitch
01-28-2005, 08:03 PM
thanks