How to add links?
- Started
- Last post
- 6 Responses
- ♣
I have a collapsable menu system that I have customized to my liking. But the one thing I can't figure out is how to add the links in the code. The menu doesn't actually appear on the stage until you view it in movie mode. I know how to change the names of the buttons but how do I add URLs?
Here is the code. Sorry about the length:
onClipEvent (load) {
// -- set up names of main items here
// -- you can add as many new sections as you want (or your computer can handle)
mainSections = new Array("PORTFOLIO", "EXPERIENCE");
// -- one array for each main Section -
subSection0 = new Array("IDENTITY", "COLLATERAL", "INTERACTIVE");
subSection1 = new Array("RESUME", "ABOUT");
// --
// --
// -- build the main buttons
for (i=0; i<mainSections.length; i++) {
attachMovie("mainButton", "main"+i, i+100);
myButton = this["main"+i];
myButton.subs = this["subSection"+i];
myButton.button.value = mainSections[i];
myButton._x = myButton._width*i;
// -- build subsection buttons for each main button
for (x=0; x<myButton.subs.length; x++) {
myButton.attachMovie("subButton... "sub"+x, x);
mySub = myButton["sub"+x];
mySub.button.value = myButton.subs[x];
mySub.button.outYpos = myButton._height+(mySub._height...
}
}
// -- function that opens the subsection on rollover
function openSubs (target) {
for (i=0; i<this[target].subs.length; i++) {
subMenuCounter = 0;
this[target]["sub"+i].button.new... = this[target]["sub"+i].button.out...
currentOpen = target;
}
}
// -- close subsections function
function closeSubs (target) {
for (i=0; i100) {
closeSubs(currentOpen);
subMenuCounter = 0;
}
}
onClipEvent (mouseUp) {
// -- this closes the curently open submenu if the user clicks outside of the menu
if (!this.hitTest(_root._xmouse, _root._ymouse)) {
closeSubs(currentOpen);
}
}anyone? thanks.
- ♣0
Muy importante! Anyone?
thanks.
- ♣0
would I make copies of the subButton and apply links to each one individually?
- ozhanlion0
what do u mean by adding url ?
if I understand correctly;
onClipEvent(release) {mybutton.getURL("here is your url", " "_blank")
}
something lke that. but I warn you, putting actions on the mc's is not advised, and if you are doin such a stuff like defining and invoking function, well it would be hardass pretty soon.
hth
- forward0
Code seems to be broken...
But I´d try building another array with links and relate the links to each subButton when building themsomething like
myButton.onPress 0 funtion()(
//getURL or loadMovie refering to this new Array with the links you created
)Hope it helps. Good luck!
- forward0
I meant
myButton.onPress =function()(
//etc
}
- JazX0
dats a lot a code