•
•
•
•
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 402,372 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 3,090 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: Programming Forums
Views: 1444 | Replies: 0
![]() |
| |
•
•
Join Date: Oct 2006
Location: Phoenix, Arizona
Posts: 6
Reputation:
Rep Power: 0
Solved Threads: 0
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();
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();
![]() |
•
•
•
•
•
•
•
•
DaniWeb Graphics and Multimedia Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Synchronized Multidimensional Array (Java)
- Photoshop: create a tabbed navigation bar (Web Design Tutorials)
- css to make navigation bar (HTML and CSS)
- How to Sort a MultiDimensional Array (C)
- Navigation Bar that extends the length of the page (HTML and CSS)
- multidimensional array (C)
Other Threads in the Graphics and Multimedia Forum
- Previous Thread: Photoshop Question
- Next Thread: streaming media - avi or mov ?


Hybrid Mode