for(var i:Number =0;i < acRate; i++){
        var ['p'+i]:MovieClip = new MovieClip()
       this['p'+i].x = i*10
       this['p'+i].y = i*10
}

Which doesn't work of course. Does anybody have a work around for this,
or is it no longer possible to create undeclared variables at run time.

The only reason I can think of that that wouldn't work is that you can't declare dynamic variables. So you could do it like this:

for(var i:Number =0;i < acRate; i++){
      this['p'+i] = new MovieClip();
      this['p'+i].x = i*10;
      this['p'+i].y = i*10;
}

But that's not really good OOP. What you should do instead is build an array of references to your movie clips, like this:

var clips:Array = new Array();
for(var i:Number =0;i < acRate; i++){
      clips[i] = new MovieClip();
      clips[i].x = i*10;
      clips[i].y = i*10;
}

ryanm
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to