Ordell
March 23, 2006, 10:37am
1
Hello,
I have a question about rotating movieclips:
If I click on mc1, then mc1 has to go to the position of mc3, mc3 has to go to the position of mc2. The same thing must happen when I click on mc2, it has to move to the position of mc3 and mc3 has to move to the position of mc1. I would like to create some kind of infinitive effect by rotating the mc’s. In a later stadium I want to fill the mc’s with pictures. But I don’t know a proper solution in as. Could somebody help me with this, or does anyone know an example? Thnx in advance.
Ordell
Ordell
March 23, 2006, 4:43pm
3
Thnx for the usefull link but I’m still having problems to build the code.
var acceleration = 12;
var friction = 0.7;
clipArray = [];
posArray = [];
for (var k = 0; k<6; k++) {
myclip = attachMovie("mc", "mc"+k, k);
myclip._y = 50+(myclip._height+40)*k;
myclip.startx = myclip._x=50;
myclip.myText.text = "Button "+(k+1);
clipArray.push(myclip);
countArray.push(k);
posArray.unshift(myclip._y);
myclip.onPress = dostuff;
}
function move() {
var xdif = posArray[this.jvar]-this._y;
this.xspeed += xdif/this._parent.acceleration;
this.xspeed *= this._parent.friction;
this._y += this.xspeed;
checkDistance.apply(this);
}
checkDistance = function () {
if (Math.abs(posArray[this.jvar]-this._y)<1) {
this._y = posArray[this.jvar];
if(this._x !=this.startx){
for(var obj in cliparray){
cliparray[obj].enabled =true
cliparray[obj].gotoAndStop(1)
}
this.enabled = false
this.gotoAndStop(2)
this.onEnterFrame = tweenx;
}
}
};
function tweenx() {
this._x += (this.startx-this._x)/4;
if (Math.abs(this.startx-this._x)<2) {
this._x = this.startx;
delete this.onEnterFrame;
}
}
function dostuff() {
this._x -= this._width;
for (var i = 0; i<clipArray.length; i++) {
clipArray*.ivar = i;
}
k = clipArray.splice(this.ivar, 1);
clipArray = clipArray.concat(k);
for (var j = 0; j<posArray.length; j++) {
clipArray[j].jvar = j;
trace(clipArray[j]+" "+clipArray[j].jvar);
clipArray[j].onEnterFrame = move;
}
}
I want to have one mc out of the row and set it right of the row with mc’s. How can I manage this? Thnx in advance
Ordell