AS2 to AS3 duplicate random MC

Hello, it’s been a long long time since a post.
Well I was playing with Flash8, doing this tutorial (http://www.kirupa.com/developer/actionscript/duplicate.htm), all is well.

Then I tried Flash CS4 and the AS doesn’t work, a lot has changed from AS2 to AS3. Well a lot for me, since programming is my weak point.

Anyways, here is the AS. How do I re-write so it will work with AS3?

onClipEvent (load) {
	scale = (random(100) + 50)

	this._x = random(600);
	this._y = random(250);
	this._alpha = random(100);
	this._xscale = scale;
	this._yscale = scale;
}

and within the MC timeline

//duplicate the sqare by 9times, and amout is >0
amount = 9;
   while(amount>0) {
//The target identifier is the name of the movie 
//clip that you choose to copy	  
//The second identifier gives a name to the duplicated movie clip
//Movie depth refers to the vertical stacking order of the new duplicate movie clip
   duplicateMovieClip (_root.square, "square" + i, i);
   i = i + 1;
   amount = amount-1;
}

Thank you