-
Hi, I'm trying to make a dynamic text box display a string of 4 or 5 numbers that rapidly change at random. I'm beginning to think that a text box may not be the way to accomplish this, but I'm at a loss. I've referenced my books, and the FLA's here on Flashkit, but just can't seem to find quite what I'm looking for. Any ideas? Thanks a lot for the help.
-
onClipEvent (enterFrame) {
_root.text = random(9)+random(9)+random(9)+random(9);
}
-you can put this code in an empty mc on the main timeline with your text box.
-dan
-
What you need to do is use something very similar to what stork wrote, but instead:
_root.text = random(10).toString() + random(10).toString() + random(10).toString() + random(10).toString() + random(10).toString()
Otherwise, it will just add up all the numbers and will generate a number between 0 and 8, not 0 and 9
-
sorry,
actually doing it that way will add the numbers. You will have to make five different text boxes and then you could do it like this:
-declare this function
function randomize(number){
_root.text[number] = random(9);
}
onClipEvent (enterFrame) {
randomize(1);
randomize(2);
etc. for how ever many text boxes you have
}
dan
-
-
Yeah, I do that sometimes (bad telepathy! bad!!)
-
Thanks
Hey that's great. Thanks to both of you.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|