'lo all.
I have tried to create ‘simple’ (!) application where a user enters a 2 digit number in a input text box with instance named ‘calc_num’, clicks a button named ‘cplay_btn’ and a random number of the movieclip ‘bf_mc’ appears on the stage, between 1 and the number in the input box. I have tried numeous ways of writing the script., of which the example below is the most simple:
cplay_btn.onRelease = function() {
var i:Number = Math.floor(Math.random()*_root.calc_num.text);
for(i; i>0; i--){
trace(i);
attachMovie("bf_mc", "temp"+i, i, {_x:Math.random()*700, _y:Math.random()*300});
}
}
The results are always the same though : if first random number is 2, 2 x bf_mc appear, if next is 4, 4 x bf_mc appear, but if next random number is say 3, 4 x bf_mc still appear. Is the variable ‘i’ holding the highest value? If so can it be cleared? Or is this far too simple, do I need to construct an array?
Thanks in advance for any advice.