| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
|
|
#1 (permalink) |
|
Registered User
Join Date: Feb 2008
Posts: 17
|
for loop question
I have a for loop that creates an amount of square sprites with random proprieties: Code:
anyone knows how I can delete all of these sprites at the same time? |
|
|
|
|
|
#2 (permalink) |
|
Battery Chicken
|
yes, don't give a generic name like mySprite i would put them in an array. i would go a bit further and create a class (that extends Sprite) for your BasicDot. the easy way: Code:
this is really unpretty. we can do this because addChild returns a DisplayObject. so mySprites_ar contains all your sprites as DisplayObjects. flash.display.DisplayObjectContainer (ActionScript 3.0) the better way: create a new class file for your BasicDot Code:
then in your original code Code:
now in either case, you can loop through each one and remove them all like this: Code:
this gives you much more flexibility and control hth. |
|
![]() |