I have a collapsible menu style website.
When I had a new nav item, it doesn’t butt up flush with the other menu items and I can’t figure out where the gap is coming from.
import mx.transitions.Tween;
import mx.transitions.easing.*;
_global.slidingMenu = this;
big_height = 336;
small_height = 64;
small_height_over = 30;
time_for_animation = 25;
time_for_animation2 = 25;
// Initialization
box1.id = 1;
box2.id = 2;
box3.id = 3;
box4.id = 4;
box5.id = 5;
for (var i = 1; i<=5; i++) {
this["box"+i].title_main.area.onRelease = function() {
slidingMenu.moveBoxes(this._parent._parent.id);
};
this["box"+i].title_main.area.onRollOver = function() {
slidingMenu.RollOverBoxes(this._parent._parent.id);
};
this["box"+i].title_main.area.onRollOut = this["box"+i].title_main.area.onReleaseOutside=function () {
slidingMenu.RollOutBoxes(this._parent._parent.id);
};
}
slidingMenu.RollOverBoxes = function(boxNumber:Number) {
if (_root.link<>boxNumber) {
var cBox:MovieClip = eval('box'+boxNumber);
cBox.title_main.gotoAndPlay("s1");
for (var i = 1; i<=5; i++) {
var cBox:MovieClip = eval('box'+i);
ykoord = cBox.my_y;
if (i<>boxNumber) {
if (i<boxNumber) {
new Tween(cBox, "_y", Back.easeOut, cBox._y, ykoord-small_height_over, time_for_animation2, false);
cBox.my_y = ykoord-small_height_over;
} else {
new Tween(cBox, "_y", Back.easeOut, cBox._y, ykoord+small_height_over, time_for_animation2, false);
cBox.my_y = ykoord+small_height_over;
}
}
}
}
};
slidingMenu.RollOutBoxes = function(boxNumber:Number) {
if (_root.link<>boxNumber) {
var cBox:MovieClip = eval('box'+boxNumber);
//cBox.title_main.gotoAndPlay("s2");
cBox.title_main.gotoAndPlay(cBox.title_main._totalframes-cBox.title_main._currentframe);
for (var i = 1; i<=5; i++) {
var cBox:MovieClip = eval('box'+i);
ykoord = cBox.my_y;
if (i<>boxNumber) {
if (i<boxNumber) {
new Tween(cBox, "_y", Back.easeOut, cBox._y, ykoord+small_height_over, time_for_animation2, false);
cBox.my_y = ykoord+small_height_over;
} else {
new Tween(cBox, "_y", Back.easeOut, cBox._y, ykoord-small_height_over, time_for_animation2, false);
cBox.my_y = ykoord-small_height_over;
}
}
}
}
};
// Functions
slidingMenu.moveBoxes = function(boxNumber:Number) {
if (_root.link<>boxNumber) {
slidingMenu.movePages(170);
k = 1;
//-1239.0
//eval('box'+_root.link).title_main.gotoAndPlay("s2");
for (var i = 1; i<=6; i++) {
var cBox:MovieClip = eval('box'+i);
if (i == boxNumber) {
_root.link_prev = _root.link;
_root.link = boxNumber;
cBox.pages.gotoAndPlay("s1");
cBox.title_main.gotoAndPlay("s2");
var cBox2:MovieClip = eval('box'+_root.link_prev);
cBox2.pages.gotoAndPlay(cBox2.pages._totalframes-cBox2.pages._currentframe);
_root.scroller.gotoAndStop(2);
}
if (i<=boxNumber) {
//new Tween(cBox, "_y", Strong.easeOut, cBox._y,(k)*(small_height) -110, time_for_animation+k*7, false);
new Tween(cBox, "_y", Regular.easeOut, cBox._y, (k)*(small_height)-30, time_for_animation, false);
cBox.my_y = (k)*(small_height)-30;
} else {
//new Tween(cBox, "_y", Strong.easeOut, cBox._y, (k)*(small_height)+big_height - 80, time_for_animation+k*7, false);
new Tween(cBox, "_y", Regular.easeOut, cBox._y, (k)*(small_height)+big_height-25, time_for_animation, false);
cBox.my_y = (k)*(small_height)+big_height-25;
}
k++;
}
}
//
//new Tween(_root.pages2, "_y", Strong.easeOut, _root.pages2._y,-329.0 + _root.link*470, time_for_animation+100, false);
};
slidingMenu.movePages = function(my_koord) {
cBox = _root.pages;
new Tween(cBox, "_y", Back.easeOut, cBox._y, my_koord, 25, false);
};
slidingMenu.resetPages = function() {
slidingMenu.moveBoxes(5);
slidingMenu.movePages(340);
};
//slidingMenu.moveBoxes();