User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Graphics and Multimedia section within the Web Development category of DaniWeb, a massive community of 397,792 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,450 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Graphics and Multimedia advertiser:
Views: 1429 | Replies: 0
Reply
Join Date: Oct 2006
Location: Phoenix, Arizona
Posts: 6
Reputation: Matty J is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Matty J Matty J is offline Offline
Newbie Poster

Help Question regarding multidimensional array for navigation bar

  #1  
Feb 28th, 2007
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", "**** 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();
AddThis Social Bookmark Button
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb Graphics and Multimedia Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the Graphics and Multimedia Forum

All times are GMT -4. The time now is 5:37 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC