| | |
Question regarding multidimensional array for navigation bar
Please support our Graphics and Multimedia advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Oct 2006
Posts: 6
Reputation:
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();
![]() |
Similar Threads
- Synchronized Multidimensional Array (Java)
- Tutorial: Photoshop: create a tabbed navigation bar (Graphics and Multimedia)
- 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: MySpace is your worst parental nightmare
- Next Thread: streaming media - avi or mov ?
| Thread Tools | Search this Thread |
3d 10 actionscript3 adobe adobeacrobat adobereader air ajax amazon amf apple button cart childprotection cloud dashboard dell design dojofoundation dreamweaver ebay eclipse ecommerce elasticcomputecloud embed endorsement extra family flash flash-develop flashlite flex free harddrive iamthwee ibm illustrator imflash intel interactivemap javafx javascript laptop legal map micron microsoft mobile monitoringsoftware moonlight multimedia myspace nand news novell panorama pdf pedophiles photoshop photosynth php safety sandisk security shopping silverlight solidstatedrive sproutcore ssd streaming swf table ukmap unload unwanted video vulnerability web white.space xml zend zephyr zeroday





