hi,
im pretty new to actionscript, and this is really my first attempt at ever
coding in it... I'm trying to make a random number generator as coding
practice, and hitting some bumps.
i want the generator to generate numbers from a range. this range is declared
by the user in Input boxes.
the generator ignores the minimum number and generates below it, but will not
generate numbers above the highest number, which i find strange. here is the
code:
//Random Number Generator
//set variables. "min" = the text with instance name "minim". "max" = the text
with instance name "maxim"
var min = minim.text;
var max = maxim.text;
/*when button with instance name "go" is released, the funtion occurs.
This function generates a random number between "max" and "min"*/}
go.onRelease = function() {
out1.text = (Math.round(Math.random()*(max-min)));
};
/*when the button with instance name "end" is released, the function occurs.
This function clears all the textboxes listed (out1 to out21).
These are output textboxes that show the generated numbers*/
end.onRelease = function() {
out1.text = "";
out2.text = "";
out3.text = "";
out4.text = "";
out5.text = "";
out6.text = "";
out7.text = "";
out8.text = "";
out9.text = "";
out10.text = "";
out11.text = "";
out12.text = "";
out13.text = "";
out14.text = "";
out15.text = "";
out16.text = "";
out17.text = "";
out18.text = "";
out19.text = "";
out20.text = "";
out21.text = "";
};
(i am fully aware that i could have used an array to clear the textboxes...
but i dont know how to, lol. if you could explain, it would be greatly
appreciated.)
the .fla can be found
http://www.cheezy-funnys.com/random%20numbers.fla
feel free to ask any questions. look forward to hearing from someone.