/* 5个变量定义元件的速度、最大、最小、数量*/ var maxSpeed:Number = 25; var minSize:Number = 4; var maxSize:Number = 10; var minFragments:Number = 50; var maxFragments:Number = 150;
/* 在最大和最小之间返回一个数的函数 */ function randRange(min:Number, max:Number):Number { var randomNum:Number = Math.floor(Math.random() * (max - min + 1)) + min; return randomNum; }
/* 主程序片段 */ onMouseDown = function():Void { var totalFragments:Number = randRange(minFragments, maxFragments); var fragment_mc:MovieClip; var depth:Number = this.getNextHighestDepth();