# Write code for all mcs?

**URL:** <https://forum.kirupa.com/t/write-code-for-all-mcs/321079>\
**Category:** Uncategorized\
**Created:** [April 10, 2011, 2:05am UTC](https://forum.kirupa.com/t/write-code-for-all-mcs/321079 "2011-04-10T02:05:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chbook](https://avatars.discourse-cdn.com/v4/letter/c/82dd89/32.png) [@Chbook](https://forum.kirupa.com/u/Chbook)\
**Post date:** [April 10, 2011, 2:05am UTC](https://forum.kirupa.com/t/write-code-for-all-mcs/321079/1 "2011-04-10T02:05:02Z")

</div>

Hi, i wish to generate salt particles but when I click the start button i want all of these particles moving across the screen.However, I can only manage one to move across the stage  
:S  
Thank you

hereis the code for the start button

on (release) {

```
var count:Number;

```

function generateSalt (){  
var salt\_no:Number = SaltStepper.value;   
for (var count:Number = 0; count\<salt\_no; count++){  
Position\_y = Math.random () \* 125 + 5  
\_root.attachMovie(“Salt\_mc”, “Salt”, this.getNextHighestDepth(), {\_x: 800, \_y: Position\_y});  
\_root.Salt.duplicateMovieClip (“Salt” + count, count);

```
}

```

}  
generateSalt();  
}
