Hallo,
ich verwende für eine Website das dynamische, horizontale Menü von Ultrashock.com.
hier der Code:
PHP-Code:
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("PHOTOGRAPHS");
// -- one array for each main Section -
subSection0 = new Array("zero", "One", "Two", "Three", "Four", "Five");
// --
// --
// -- 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*x);
}
}
// -- 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.newY = this[target]["sub"+i].button.outYpos;
currentOpen = target;
}
}
// -- close subsections function
function closeSubs (target) {
for (i=0; i<this[target].subs.length; i++) {
this[target]["sub"+i].button.newY = this[target]["sub"+i].button.oYpos;
}
}
// - this is the function you would change to load content, or add more functionality to the buttons
function doSubSection (target, sub) {
myButton["sub"+1].onRelease = function() {
_root.contents.loadMovie("gallery_drawings.swf")
}
}
}
onClipEvent (enterFrame) {
// -- a timer that closes the menus after a certain amount of time
subMenuCounter++;
if (subMenuCounter>100) {
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);
}
}
Über Subbutton "One" lade ich bereits ein externes swf ein:
(Auszug aus oben abgebildeten Code)
PHP-Code:
myButton["sub"+1].onRelease = function() {
_root.contents.loadMovie("gallery_drawings.swf")
klappt auch alles prima.
Problem aber: ich muss zweimal draufklicken, damit das swf geladen wird.
Wie kann das sein?
Auf den Subbuttons liegt übrigens ein Rollovereffekt in Form einer Schaltfläche. Wenn ich auf den Subbutton 1 zum ersten Mal klicke, ist die Rollover-schaltfläche noch sichtbar und nichts wird geladen.
Beim zweiten Klick ist die Rollover-Schaltfläche über dem Subbutton verschwunden und der Button lädt das externe swf.
Wie kann das sein? Warum macht diese Rollover-Schaltfläche Probleme und verschwindet nach dem 1.Klick plötzlich?
Vielen dank im Voraus für eure Hilfe!
Bixi.