![]() |
| ||
| Question regarding multidimensional array for navigation bar I'm using a multidimensional array to create a basic nav bar for a website i've been working on for a while.. I'm still very much a "noob" to programming, which is most likely the reason for the concussion I've sustained from repeatedly slamming my head against my desk.;) anyway my problem is that i can't figure out how to "target" the specific buttons in my sub-menu (the drop down).. I've figured out how to target the buttons as a whole (as in when i use a trace command, they all perform identically, ((the sub menu vs, the primary))) ... I'm also having a wee bit of trouble with rollover effects, but at the moment they are the least of my concern... I need to know what i need to do to, say, make it so the "accessories" button either initiates a loadMovieNum() or getURL command.... I appreciate any help anyone can offer, and I also appreciate all the help which has been provided in the past... I've pasted the code below, #include "lmc_tween.as" // ### Array and Variables ### \\ var menu_arr:Array = new Array([["Home"], "home"], [["Motorcycles", "Parts", "Accessories", "Gear", "Store"], "inst"], [["Quads", "Parts", "Accessories", "Gear", "Store"], "Go To Store"], [["Department", "Water Sports", "Toy Haulers", "Fu"],"page"], [["Contact", "Location", "Email"],"contact"]); //var menu_arr:Array = new Array([["Home"], "home"], [["Instructions", "how", "what", "where", "fuck it"], "inst"], [["Play Game", "who", "why"], "playGame"], [["Create Character"], "create"], [["Quit Game"], "quit"]);\\ // ### Functions ### \\ function makeMenu() { for (var i:Number = 0; i < menu_arr.length; i++) { var newName:MovieClip = this.attachMovie("item_mc", menu_arr[i][1] + "_mc", this.getNextHighestDepth()); newName._alpha = 0; var newX:Number = Math.abs((newName._width + 15) * i); newName._x = Stage.width + 200; newName._y = 50; newName.id = i; // Refers to current array index. newName.slideTo(newX, "_y", 2, "linear", i / 8); newName.alphaTo(100, 2, "linear", i / 8); newName.item_txt.text = menu_arr[i][0][0]; newName.onRollOver = function() { makeSubMenu(this.id, this._x); } newName.onRelease = function() { trace(this.id); } } } function makeSubMenu(mainId, mainX) { container_mc.removeMovieClip(); this.createEmptyMovieClip("container_mc", this.getNextHighestDepth()); for (var i:Number = 1; i < menu_arr[mainId][0].length; i++) { //trace(i); var newSub:MovieClip = container_mc.attachMovie("item_mc", "sub" + i + "_mc", i); newSub._x = mainX;// Math.abs(mainX + ((newSub._width + 2) * (i - 1))); newSub._y = Math.abs(100 + ((newSub._height + 2) * (i - 1))); newSub.item_txt.text = menu_arr[mainId][0][i]; newSub._alpha = 0; newSub.alphaTo(100, 1, "linear"); newSub.onRollOver = function(){ this.gotoAndPlay(2); } newSub.onRollOut = function(){ gotoAndPlay(1); } newSub.onRelease = function(){ trace("this button werks d**che bag..."); } } } //newName.onRollOut = function(){ // this.newSub.alphaTo(0, 1, "linear", 0); //} makeMenu(); |
| All times are GMT -4. The time now is 8:32 am. |
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC