Hi
I’ve build a very simple horizontal accordion-like sliding Menu.
It works except for the rollout after the release, then it slides back instead of staying in position.
The problem is that I need a slide back after the rollover on the rollout.
But I dont after the release.
In the end it should look like >>this<<.
function movItem(clip, speed, x) {
clip.onEnterFrame = function() {
var a = Math.abs(x-clip._x);
clip._x += (Math.round(x-clip._x))/speed;
if (a<=1) {
clip._x = x;
delete clip.onEnterFrame;
}
};
}
for (var i = 1; i<6; i++) {
this["mc"+i].ID = i;
this["mc"+i].onRollOver = function() {
if (this.ID == 1) {
movItem(mc1, 5, 30);
movItem(mc2, 5, 60);
movItem(mc3, 5, 90);
}
if (this.ID == 2) {
movItem(mc2, 5, 60);
movItem(mc3, 5, 90);
}
if (this.ID == 3) {
movItem(mc3, 5, 90);
}
};
this["mc"+i].onRollOut = function() {
if (this.ID == 1) {
movItem(mc1, 5, 0);
movItem(mc2, 5, 30);
movItem(mc3, 5, 60);
}
if (this.ID == 2) {
movItem(mc2, 5, 30);
movItem(mc3, 5, 60);
}
if (this.ID == 3) {
movItem(mc3, 5, 60);
}
};
this["mc"+i].onRelease = function() {
if (this.ID == 1) {
movItem(mc1, 5, 220);
movItem(mc2, 5, 250);
movItem(mc3, 5, 280);
}
if (this.ID == 2) {
movItem(mc2, 5, 250);
movItem(mc3, 5, 280);
}
if (this.ID == 3) {
movItem(mc3, 5, 280);
}
};
}
Does somebody have suggestions about make it work like the example in the link or a better starting point to reach what I’m after?