PDA

View Full Version : lottery program



red_sun
December 10th, 2003, 08:56 PM
Hello,every one!
I want my flash to obtain the following effect. But I am in trouble.
There are two buttons and a dynamic text box in my flash.The two buttons are start and end button. When you click the start button,you will find the random data in the dynamic text box changing constantly until you click the stop button.
Can anyone help me, thanks a lot!

Voetsjoeba
December 11th, 2003, 05:43 AM
maximum = 1000
ref = _root.createEmptyMovieClip("ctrl",-50);
startButton.onRelease = function(){
ref.onEnterFrame = function(){
displayTextField.text = Math.floor(Math.random()*(maximum+1))
}
}
stopButton.onRelease = function(){
delete ref.onEnterFrame
}


Something like that should do it :)

red_sun
December 15th, 2003, 02:31 AM
Thanks a lot!
I have worked it out using the two useful functions! One is setInterval,another is clearInterval.

Voetsjoeba
December 15th, 2003, 06:07 AM
You can do it that way too :) Glad you got it figured out :)