
Код:
var r_mc:MovieClip = rct(this, Stage.width, Stage.height, Math.random()*0xffffff, 100);
r_mc._x = Stage.width/2;
r_mc._y = Stage.height/2;
var r_mc:MovieClip = rct(r_mc, Stage.width/2, Stage.height/2, Math.random()*0xffffff, 100);
r_mc._rotation = Math.floor(Math.random()*360-180);
var r_mc:MovieClip = rct(r_mc, Stage.width/4, Stage.height/4, Math.random()*0xffffff, 100);
r_mc._rotation = Math.floor(Math.random()*360-180);
var r_mc:MovieClip = rct(r_mc, Stage.width/8, Stage.height/8, Math.random()*0xffffff, 100);
r_mc._rotation = Math.floor(Math.random()*360-180);
r_mc.onRelease = function(){
this._rotation -= rotateBack(this);
}
function rotateBack(mc:MovieClip):Number {
if(!mc._parent){
return mc._rotation;
} else {
return mc._rotation + rotateBack(mc._parent);
}
}
function rct(_mc:MovieClip, w:Number, h:Number, c:Number, a:Number):MovieClip {
var mc:MovieClip = _mc.createEmptyMovieClip("rct"+_mc.getNextHighestDepth(), _mc.getNextHighestDepth());
mc.beginFill(c,a);
mc.moveTo(-w/2,-h/2);
mc.lineTo(w/2,-h/2);
mc.lineTo(w/2,h/2);
mc.lineTo(-w/2,h/2);
mc.lineTo(-w/2,-h/2);
mc.endFill();
return mc;
}