Position thrue AS

Hello reader, I have a small problem with repositioning dynamicly attached mc’s

In my flash I attachMovie 50 times and place them randomly…this works perfect, but now I want to move their position with the click of a button

for (i=0; i<aantal; i++) {
                //nieuwe random positie maken voor de edelstenen
                x2 = Math.floor(Math.random()*(500-50+1))+50;
                y2 = Math.floor(Math.random()*(500-50+1))+50;
                with ("edelsteen"+i) {
                    this._x = x2;
                    this._y = y2;
                }
            }

this somehow works…but with only one mc…I want them ALL to repositioning.

Anyone know where Im wrong ?

for (v=0; v<aantal; v++) {
				//nieuwe random positie maken voor de edelstenen
				x2 = Math.floor(Math.random()*(500-50+1))+50;
				y2 = Math.floor(Math.random()*(500-50+1))+50;
				_root["edelsteen"+v]._x = x2;
				_root["edelsteen"+v]._y = y2;
			}
		}

ah I found it :smiley:

for (i=0; i<aantal; i++) {
    var tempPath = this.attachMovie("edel", "edelsteen"+i, i);
    tempPath._x = Math.floor(Math.random()*(500-50+1))+50;
    tempPath._y = Math.floor(Math.random()*(500-50+1))+50;
}

Oh i see youve already ot it… well this will also work, and its cleaner! :thumb:

nope yourse isnt cleaner, its attaching again movies :wink:

I had allready created 50 mc’s with random positioning, but I wanted them to “shuffle” on a mouseklik.

oh lol, I thought you had forgotten the attachMovie part :stuck_out_tongue: