The code is as follows:
import mx.transitions.*;
import mx.transitions.easing.*;
var r:number = 45;
var p:number = 0;
var drag:boolean = false;
var num:number = 0;
var name_array:array = new Array ("Flash", "Bar", "2", "0", "0", "8", "Xing", "Wang", "FA", "exhibition");
this.createemptymovieclip ("Container", this.getnexthighestdepth ());
/* Rotary * *
function Start_func () {
for (var i:number = 0; i<=9; i++) {
Container.attachmovie ("Ball", "ball" +i, I);
container[, "ball" +i]._x = 225+r* (Math.Abs (4.5-i)) *math.cos (135-(Math.floor ((I/5)) *180));
container[, "ball" +i]._y = 225+r* (Math.Abs (4.5-i)) *math.sin (135-(Math.floor ((I/5)) *180));
container["Ball" +i].txt.text = name_array[i];
container["Ball" +i].i = i;
container["ball" +i].onenterframe = function () {
var my_color:color = new color (THIS._MC);
My_color.setrgb (Math.random () *0xffffff);
this._x = 225+r* (Math.Abs (4.5-THIS.I)) *math.cos (135-(Math.floor ((THIS.I/5)) *180)) +p);
this._y = 225+r* (Math.Abs (4.5-THIS.I)) *math.sin (135-(Math.floor ((THIS.I/5)) *180)) +p);
p = p+0.5;
};
container["ball" +i].onpress = function () {
var mytween:tween = new Tween (This, "_xscale", Elastic.easeout, MB, 1, true);
var mytween:tween = new Tween (This, "_yscale", Elastic.easeout, MB, 1, true);
};
container["ball" +i].onrelease = function () {
var mytween:tween = new Tween (This, "_xscale", Elastic.easeout, MB, 1, true);
var mytween:tween = new Tween (This, "_yscale", Elastic.easeout, MB, 1, true);
};
}
}
Start_func ();
* * Drag follow/
var mouselistener:object = new Object ();
Mouselistener.onmousedown = function () {
if (container["Ball" +0].hittest (_root._xmouse, _root._ymouse)) {
drag = true;
}
};
mouselistener.onmousemove = function () {
if (drag) {
num = 1;
Delete container["Ball" +0].onenterframe;
container["Ball" +0]._x = _root._xmouse;
container["Ball" +0]._y = _root._ymouse;
for (var i:number = 1; i<=9; i++) {
Delete container["Ball" +i].onenterframe;
container["Ball" +i]._x + = (container["Ball" + (i-1)]._x-container["Ball" +i]._x)/3;
container["Ball" +i]._y + = (container["Ball" + (i-1)]._y-container["Ball" +i]._y)/3;
}
}
};
mouselistener.onmouseup = function () {
drag = false;
/* Drag to restore * *
if (num==1) {
Start_func ();
num=0;
}
};
Mouse.addlistener (MouseListener);