PDA

View Full Version : Not sure how to end this script


Holden
06-12-2002, 08:43 PM
onClipEvent (load) {
go = true;
}
onClipEvent (enterFrame) {
if (go) {
x = random(122);
if ((x>=65) and (x<=122)) {
this.letter2 = chr(x);
}
if (x == 116) {
go = false;
}
}
}


I have this code duplicated several times within a MC on my mainstage. It is from a tutorial I've been working through. It basically randomly picks letters until it finds the correct one, then stops. I have several of these text fields with this actionscript to make up a word, that unscrambles. But thats where the movie ends. I want it to finish the script then continue along the Main movie timeline, and then return to frame 1 and begin again.


any idea what i could change or add ?

Ricod
06-18-2002, 12:16 PM
Not sure what ur trying to do here. But :
since its repeated, consider using functions (see the lovely tutorial section) and read up on it and on variables. (U could use them to change the character nr.)

Lets say u want the characters "C - O - D - E" to appear, u could use the function with a loop (theres a tutorial for that too) in it until the right charcter nr. appears, and then break from it and move the mc to the next frame, on which the function is called again, but then with the character nr. for the next letter. Until the last letter is found and then send it to the first.