View Full Version : creation of an dynamic iteration

09-29-2005, 02:48 PM

i've looked for a tutorial on this but didn't found it...
I'd like to create an animation where the visiter could insert the number of balls he'd like to see. it's a bit easy but I've got a lot of problem to execute it...
for info :
play_btn is the instance name of the button which serve to execute the script.
numberBall_txt is the instance name of the input text where the visiter can insert the number of balls.
Ball is the name of the movieClip (either in the linkage).

I think the problem is :
trace(typeof(occurence)); ==> string !

I give you the little code I whrought :


play_btn.onRelease = function(){
// trace(numberBall_txt.text);
if (numberBall_txt.text == "" || numberBall_txt.text <= 1){
// trace("check1 "+id);
ball_1_mc._x = 100;
ball_1_mc._y = 100;
id= Number(numberBall_txt.text);
// trace("check2 "+id);
var i;
for (i=2;i<id+1;i++){
_root.attachMovie("Ball",occurence = "ball_"+i+"_mc",i);
occurence._x = 100 + 10*i;
occurence._y = 100 - 10*i;

Thank You very much for your help,
I begin to be mad with this little problem...