# Whats wrong with this?

**URL:** https://forum.kirupa.com/t/whats-wrong-with-this/204538
**Category:** Uncategorized
**Created:** [October 20, 2006, 4:40pm UTC](https://forum.kirupa.com/t/whats-wrong-with-this/204538 "2006-10-20T16:40:06Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![bennymartensson](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/bennymartensson/32/1317_2.png) [@bennymartensson](https://forum.kirupa.com/u/bennymartensson)
#### Post date: [October 20, 2006, 4:40pm UTC](https://forum.kirupa.com/t/whats-wrong-with-this/204538/1 "2006-10-20T16:40:06Z")

</div>

I’ve just changed the tween method in this code. I commented out the old stuff and this just don’t work. Someone who can spot the problem?

```auto

// FUNCTIONS
_global.$tweenManager.broadcastEvents = true;
// Main menu
function createMainMenu() {
	var a = 1;
	var total = mm_array.length;
	while (a<=total) {
		ypos = ((a-1)*homm)+1;
		attachMovie("mainnav_mc", "mainnav"+a+"_mc", this.getNextHighestDepth()+100, {_x:0, _y:ypos});	// attach the movieClip
		var nc = this["mainnav"+a+"_mc"];
		nc.menutext = mm_array[(a-1)];	// set the title text for each button
		nc.itemnum = a;	// set the menu #
		a++;
	}
}
function moveMenu(num) {
	if ((_root.collapsed == true) || (_root.selectedmenu != num)) {
		var array = "sm"+num+"_array";
		var totalsm = eval(array).length;
		var totalmm = mm_array.length;
		var a = 1;
		while (a<=totalmm) {
			mc = this["mainnav"+a+"_mc"];
			if (a>num) {
				var ypos:Number = (((a-1)*homm)+1)+totalsm*(hosm+1);
				//mc.tween("_y", ypos, speed, ease);
				mc.slideTo("", ypos, speed, ease);
			} else {
				var ypos = ((a-1)*homm)+1;
				if (a == num) {
					var nypos:Number = ypos;
					//mc.tween("_y", ypos, speed, ease, 0, onEnd(num, nypos));
					mc.slideTo("", ypos, speed, ease, 0, onEnd(num, nypos));
				} else {
					//mc.tween("_y", ypos, speed, ease);
					mc.slideTo("", ypos, speed, ease);
				}
			}
			a++;
		}
		_root.collapsed = false;
	} else {
		contractMenu()
		_root.collapsed = true;
	}
}
function onEnd(num, nypos) {
	_root.num = num;
	createSubMenu(num, nypos);
}
function contractMenu() {
	var c = 1;
	while (c<=submenu_array.length) {
		removeMovieClip("subnav"+c+"_mc");
		c++;
	}
	var g = 1;
	while (g<=mm_array.length) {
		var ypos:Number = ((g-1)*homm)+1;
		//this["mainnav"+g+"_mc"].tween("_y", ypos, speed, ease);
		this["mainnav"+g+"_mc"].slideTo("", ypos, speed, ease);
		g++;
	}
}
function createSubMenu(num, nypos) {
    var array = "sm"+num+"_array";
    var totalsm = eval(array).length;
    var ypos = nypos+4;
    var c = 1;
    while (c<=submenu_array.length) {
        removeMovieClip("subnav"+c+"_mc");
        c++;
    }
    submenu_array = [];
    var a = 1;
    while (a<=totalsm) {
        var ypos:Number = ypos+hosm+1;
        attachMovie("subnav_mc", "subnav"+a+"_mc", a+30, {_x:0, _y:ypos});
        nc = this["subnav"+a+"_mc"];
        nc._alpha = 0;
        nc.itemnum = a;
        nc.menutext = eval(array)[(a-1)];
        nc.alphaTo(100, 2);
        submenu_array.push("subnav"+a+"_mc");
        a++;
		}
}

// BUILD MENU
_root.collapsed = true;
createMainMenu();

```
