Visualizzazione dei risultati da 1 a 10 su 10

Discussione: cascading menu

  1. #1
    Utente di HTML.it
    Registrato dal
    Jun 2006
    Messaggi
    11

    cascading menu

    salve a tutti ho trovato un cascadingmenu dal sito: http://www.tverde.com.br/lucas/
    il nome del file è cascadingmenu.

    fatto tutto, non essendo esperto apro il file e una volta installati i vari files lmc_tween.as etc... me lo adatto alla mia finestra... tutto fatto ma non so come dare ad i vari pulsanti i collegamenti che vorrei (http://etc...) come si fa? chiedo aiuto visto che il menù è facilmente modificabile ma non so dove mettere le mani grazie

    Codice PHP:
    ______________
    // Variables -----------------------------------------------------------------------
    // Height of Mainmenu items
    var homm 20;
    // Height of Submenu items
    var hosm 15;
    // mm_array contains the main menu, sm#_array contains the sub menu items for menu #
    var mm_array:Array = ["Some Menu""Second Menu""Third Menu""Fourth Menu""Fifth Menu""Created by Mav""creato da daniele"];
    var 
    sm1_array:Array = ["Submenu 1""Submenu 2""Submenu 3""Submenu 4"];
    var 
    sm2_array:Array = ["Submenu 1""Submenu 2"];
    var 
    sm3_array:Array = ["Submenu 1""Submenu 2""Submenu 3""Submenu 4""Submenu 5"];
    var 
    sm4_array:Array = ["Submenu 1""Submenu 2""Submenu 3""Submenu 4""Submenu 5""Submenu 2""Submenu 3""Submenu 4""Submenu 2""Submenu 3""Submenu 4"];
    var 
    sm5_array:Array = ["Submenu 1""Submenu 2""Submenu 3""Submenu 4""Submenu 5"];
    var 
    sm6_array:Array = ["Submenu 1""Submenu 2""Submenu 3""Submenu 4""Submenu 5"];
    var 
    sm7_array:Array = ["Submenu 1""Submenu 2""Submenu 3""Submenu 4""Submenu 5"];
    var 
    submenu_array:Array = [];
    // Functions ------------------------------------------------------------------------
    _global.$tweenManager.broadcastEvents true;
    // Main menu
    function createMainMenu() {
        var 
    1;
        var 
    total mm_array.length;
        while (
    a<=total) {
            
    ypos = ((a-1)*homm)+1;
            
    attachMovie("mainnav_mc""mainnav"+a+"_mc"this.getNextHighestDepth()+100, {_x:0_y:ypos});    // attach the movieClip
            
    var nc this["mainnav"+a+"_mc"];
            
    nc.menutext mm_array[(a-1)];    // set the title text for each button
            
    nc.itemnum a;    // set the menu #
            
    a++;
        }
    }
    function 
    moveMenu(num) {
        if ((
    _root.collapsed == true) || (_root.selectedmenu != num)) {
            var array = 
    "sm"+num+"_array";
            var 
    totalsm = eval(array).length;
            var 
    totalmm mm_array.length;
            var 
    1;
            while (
    a<=totalmm) {
                
    mc this["mainnav"+a+"_mc"];
                if (
    a>num) {
                    var 
    ypos = (((a-1)*homm)+1)+totalsm*(hosm+1);
                    
    mc.tween("_y"ypos0.5"easeOutCubic"); 
                } else {
                    var 
    ypos = ((a-1)*homm)+1;
                    if (
    == num) {
                        
    nypos ypos;
                        
    mc.tween("_y"ypos0.5"easeOutCubic"0onEnd(numnypos));
                    } else {
                        
    mc.tween("_y"ypos0.5"easeOutCubic");
                    }
                }
                
    a++;
            }
            
    _root.collapsed false;
        } else {
            
    contractMenu()
            
    _root.collapsed true;
        }
    }
    function 
    onEnd(numnypos) {
        
    _root.num num;
        
    createSubMenu(numnypos);
    }
    function 
    contractMenu() {
        var 
    1;
        while (
    c<=submenu_array.length) {
            
    removeMovieClip("subnav"+c+"_mc");
            
    removeMovieClip("mask"+c+"_mc");
            
    c++;
        }
        var 
    1;
        while (
    g<=mm_array.length) {
            
    ypos = ((g-1)*homm)+1;
            
    this["mainnav"+g+"_mc"].tween("_y"ypos0.5"easeOutCubic");
            
    g++;
        }
    }
    function 
    createSubMenu(numnypos) {
        var array = 
    "sm"+num+"_array";
        var 
    totalsm = eval(array).length;
        var 
    ypos nypos+4;
        var 
    1;
        while (
    c<=submenu_array.length) {
            
    removeMovieClip("subnav"+c+"_mc");
            
    removeMovieClip("mask"+c+"_mc");
            
    c++;
        }
        
    submenu_array = [];
        var 
    1;
        while (
    a<=totalsm) {
            
    ypos ypos+hosm+1;
            
    attachMovie("subnav_mc""subnav"+a+"_mc"a+30, {_x:0_y:ypos});
            if (
    num != mm_array.length) {
                
    attachMovie("mask_mc""mask"+a+"_mc"a+990, {_x:0_y:0});
                
    mask_mc this["mask"+a+"_mc"];
                
    mask_mc._alpha 10;
                
    mask_mc.onEnterFrame = function() {
                    
    this._height _parent.container_mc["mainnav"+mm_array.length+"_mc"]._y;
                };
                
    this["subnav"+a+"_mc"].setMask(mask_mc);
            }
            
    nc this["subnav"+a+"_mc"];
            
    nc._alpha 0;
            
    nc.itemnum a;
            
    nc.menutext = eval(array)[(a-1)];
            
    nc.alphaTo(1002);
            
    nc.onRelease = function() {
                
    // Function to get submenu actions needs to go here
                
    var my_str:String = new String(this);
                
    _root.select "Stai visitando:"+my_str.slice(18);
            };
            
    submenu_array.push("subnav"+a+"_mc");
            
    a++;
        }
    }
    // Build Menu -----------------------------------------------------------------------
    _root.collapsed true;
    createMainMenu(); 
    urban birds

  2. #2
    Utente di HTML.it L'avatar di and80
    Registrato dal
    Mar 2003
    Messaggi
    15,182
    ho messo il tuo codice dentro ai tag [php-] perchè era difficile da leggere senza formattazione

    comunque la parte che ti interessa è questa

    codice:
    nc.onRelease = function() {
    // Function to get submenu actions needs to go here
    var my_str:String = new String(this);
    _root.select = "Stai visitando:"+my_str.slice(18);
    };
    come indicato dal commento, è qui dentro che devi inserire le tue azioni da dare ai submenù

  3. #3
    Utente di HTML.it
    Registrato dal
    Jun 2006
    Messaggi
    11
    si grazie e scusa ma non sono come detto espertissimo di modi e maniere... ciauz... e spero tu possa aiutarmi
    urban birds

  4. #4
    Utente di HTML.it L'avatar di and80
    Registrato dal
    Mar 2003
    Messaggi
    15,182
    ho modificato il mio messaggio precedente aggiungendo la soluzione, o meglio... il punto in cui operare per arrivare alla soluzione

  5. #5
    Utente di HTML.it
    Registrato dal
    Jun 2006
    Messaggi
    11
    scusa ma non ho ben capito dove devo operare...

    indicami un attimo la strada ...
    urban birds

  6. #6
    Utente di HTML.it L'avatar di and80
    Registrato dal
    Mar 2003
    Messaggi
    15,182
    la strada è quella che ti ho indicato, cioè aggiungi dentro a quella "zona" il codice che vuoi che venga eseguito dai pulsanti, hai parlato di link... perciò dovresti associare ad ogni submenù un link da eseguire
    il codice è un po' corposo e in questo momento non riesco ad approfondirlo, comunque direi che la strada è quella di proporre tanti array quanto sono quelli dei submenù, ed in ogni array far corrispondere l'indirizzo a cui si vuole andare per ogni submenù,

    ad esempio hai la riga

    var sm2_array:Array = ["Submenu 1", "Submenu 2"];

    devi proporre anche una riga

    var um2_array:Array = ["http://www.google.it", "http://www.yahoo.it"];

    così da far corrispondere poi il pulsante al link corrispondente

    Second Menu->Submenu 1 >> apre >> http://www.google.it
    Second Menu->Submenu 2 >> apre >> http://www.yahoo.it

    spero che si comprenda il meccanismo

    nella zona che ti ho indicato in precedenza va aggiunto il getURL e si potrebbe fare così

    nc.onRelease = function() {
    // Function to get submenu actions needs to go here
    var my_str:String = new String(this);
    _root.select = "Stai visitando:"+my_str.slice(18);
    getURL(this.theURL)
    };

    manca una sola modifica, quella di assegnare ad ogni submenù la variabile theURL che conterrà l'url corrispondente... ma ora come ti ho detto, non riesco a verificare il codice per capire dove "infilare" la modifica, ti farò sapere a breve... comunque ti ho dato un input che puoi seguire per tentare di modificare tu stesso il menù, tentar non nuoce

  7. #7
    Utente di HTML.it
    Registrato dal
    Jun 2006
    Messaggi
    11

    intanto grazie

    buongiorno e grazie mille per le indicazioni... mi metto ora al lavoro e nel giro di un'ora ti faccio sapere i progressi... intanto grazie di nuovo
    offrite veramente un ottimo forum...


    ciao da daniele
    urban birds

  8. #8
    Utente di HTML.it
    Registrato dal
    Jun 2006
    Messaggi
    11

    ancora difficoltà.

    non riesco proprio, mi mancano i fondamentali è evidente... non riesco a capire la funzione da inserire e dove... sarà che è venerdi.. io al momento avrei fatto questo
    urban birds

  9. #9
    Utente di HTML.it
    Registrato dal
    Jun 2006
    Messaggi
    11
    Codice PHP:
    // Variables -----------------------------------------------------------------------
    // Height of Mainmenu items
    var homm 20;
    // Height of Submenu items
    var hosm 15;
    // mm_array contains the main menu, sm#_array contains the sub menu items for menu #
    var mm_array:Array = ["HOTEL""CENTRO BENESSERE""MEETING""RISTORANTE""SPORT IN VACANZA""CONTATTACI"];
    var 
    sm1_array:Array = ["camere""prezzi""gruppi""speciale bambini""speciale terza età"];
    var 
    sm2_array:Array = ["trattamenti""beauty farm""programmi speciali"];
    var 
    sm3_array:Array = ["gli spazi""organizzazione eventi""banchetti""catering""il teatro"];
    var 
    sm4_array:Array = ["le sale""i menu""accoglienza"];
    var 
    sm5_array:Array = ["animazione""il maneggio""tennis""footin""ciclismo""wind surf"];
    var 
    sm6_array:Array = ["richiedi informazioni""prenota""info generali"];
    var 
    submenu_array:Array = [];
                var 
    um1_array:Array = ["http://www.google.it""http://www.yahoo.it""http://www.yahoo.it","http://www.yahoo.it"];
                var 
    um2_array:Array = ["http://www.google.it""http://www.yahoo.it""http://www.yahoo.it","http://www.yahoo.it"];
                var 
    um3_array:Array = ["http://www.google.it""http://www.yahoo.it""http://www.yahoo.it","http://www.yahoo.it"];
                var 
    um4_array:Array = ["http://www.google.it""http://www.yahoo.it""http://www.yahoo.it","http://www.yahoo.it"];
                var 
    um5_array:Array = ["http://www.google.it""http://www.yahoo.it""http://www.yahoo.it","http://www.yahoo.it"];
                var 
    um6_array:Array = ["http://www.google.it""http://www.yahoo.it""http://www.yahoo.it","http://www.yahoo.it"];
    // Functions ------------------------------------------------------------------------
    _global.$tweenManager.broadcastEvents true;
    // Main menu
    function createMainMenu() {
        var 
    1;
        var 
    total mm_array.length;
        while (
    a<=total) {
            
    ypos = ((a-1)*homm)+1;
            
    attachMovie("mainnav_mc""mainnav"+a+"_mc"this.getNextHighestDepth()+100, {_x:0_y:ypos});    // attach the movieClip
            
    var nc this["mainnav"+a+"_mc"];
            
    nc.menutext mm_array[(a-1)];    // set the title text for each button
            
    nc.itemnum a;    // set the menu #
            
    a++;
        }
    }
    function 
    moveMenu(num) {
        if ((
    _root.collapsed == true) || (_root.selectedmenu != num)) {
                var array = 
    "sm"+num+"_array";
                var 
    totalsm = eval(array).length;
                var 
    totalmm mm_array.length;
                var 
    1;
            while (
    a<=totalmm) {
                    
    mc this["mainnav"+a+"_mc"];
                if (
    a>num) {
                        var 
    ypos = (((a-1)*homm)+1)+totalsm*(hosm+1);
                    
    mc.tween("_y"ypos0.5"easeOutCubic"); 
                } else {
                    var 
    ypos = ((a-1)*homm)+1;
                    if (
    == num) {
                        
    nypos ypos;
                        
    mc.tween("_y"ypos0.5"easeOutCubic"0onEnd(numnypos));
                    } else {
                        
    mc.tween("_y"ypos0.5"easeOutCubic");
                    }
                }
                
    a++;
            }
            
    _root.collapsed false;
        } else {
            
    contractMenu()
            
    _root.collapsed true;
        }
    }
    function 
    onEnd(numnypos) {
        
    _root.num num;
        
    createSubMenu(numnypos);
    }
    function 
    contractMenu() {
        var 
    1;
        while (
    c<=submenu_array.length) {
            
    removeMovieClip("subnav"+c+"_mc");
            
    removeMovieClip("mask"+c+"_mc");
            
    c++;
        }
        var 
    1;
        while (
    g<=mm_array.length) {
            
    ypos = ((g-1)*homm)+1;
            
    this["mainnav"+g+"_mc"].tween("_y"ypos0.5"easeOutCubic");
            
    g++;
        }
    }
    function 
    createSubMenu(numnypos) {
        var array = 
    "sm"+num+"_array";
        var 
    totalsm = eval(array).length;
        var 
    ypos nypos+4;
        var 
    1;
        while (
    c<=submenu_array.length) {
            
    removeMovieClip("subnav"+c+"_mc");
            
    removeMovieClip("mask"+c+"_mc");
            
    c++;
        }
        
    submenu_array = [];
        var 
    1;
        while (
    a<=totalsm) {
            
    ypos ypos+hosm+1;
            
    attachMovie("subnav_mc""subnav"+a+"_mc"a+30, {_x:0_y:ypos});
            if (
    num != mm_array.length) {
                
    attachMovie("mask_mc""mask"+a+"_mc"a+990, {_x:0_y:0});
                
    mask_mc this["mask"+a+"_mc"];
                
    mask_mc._alpha 10;
                
    mask_mc.onEnterFrame = function() {
                    
    this._height _parent.container_mc["mainnav"+mm_array.length+"_mc"]._y;
                };
                
    this["subnav"+a+"_mc"].setMask(mask_mc);
            }
            
    nc this["subnav"+a+"_mc"];
            
    nc._alpha 0;
            
    nc.itemnum a;
            
    nc.menutext = eval(array)[(a-1)];
            
    nc.alphaTo(1002);
            
    nc.onRelease = function() {
                
    // Function to get submenu actions needs to go here
                
    var my_str:String = new String(this);
                
    // inserimento fatto da me dei links - prova effettuata 13-04-2007
                
            
    };
            
    submenu_array.push("subnav"+a+"_mc");
            
    a++;
        }
    }
    // Build Menu -----------------------------------------------------------------------
    _root.collapsed true;
    createMainMenu(); 
    urban birds

  10. #10
    Utente di HTML.it L'avatar di and80
    Registrato dal
    Mar 2003
    Messaggi
    15,182
    gli array dei link devono avere lo stesso numero di elementi degli array dei submenù corrispondenti, altrimenti la cosa non funziona come dovrebbe

    comunque ho buttato giù (alla cieca ) le modifiche che ritengo possano essere corrette, questo è il codice
    Codice PHP:
    // Variables -----------------------------------------------------------------------
    // Height of Mainmenu items
    var homm 20;
    // Height of Submenu items
    var hosm 15;
    // mm_array contains the main menu, sm#_array contains the sub menu items for menu #
    var mm_array:Array = ["HOTEL""CENTRO BENESSERE""MEETING""RISTORANTE""SPORT IN VACANZA""CONTATTACI"];
    var 
    sm1_array:Array = ["camere""prezzi""gruppi""speciale bambini""speciale terza età"];
    var 
    sm2_array:Array = ["trattamenti""beauty farm""programmi speciali"];
    var 
    sm3_array:Array = ["gli spazi""organizzazione eventi""banchetti""catering""il teatro"];
    var 
    sm4_array:Array = ["le sale""i menu""accoglienza"];
    var 
    sm5_array:Array = ["animazione""il maneggio""tennis""footin""ciclismo""wind surf"];
    var 
    sm6_array:Array = ["richiedi informazioni""prenota""info generali"];
    var 
    submenu_array:Array = [];
    var 
    um1_array:Array = ["http://www.google.it""http://www.yahoo.it""http://www.yahoo.it""http://www.yahoo.it"];
    var 
    um2_array:Array = ["http://www.google.it""http://www.yahoo.it""http://www.yahoo.it""http://www.yahoo.it"];
    var 
    um3_array:Array = ["http://www.google.it""http://www.yahoo.it""http://www.yahoo.it""http://www.yahoo.it"];
    var 
    um4_array:Array = ["http://www.google.it""http://www.yahoo.it""http://www.yahoo.it""http://www.yahoo.it"];
    var 
    um5_array:Array = ["http://www.google.it""http://www.yahoo.it""http://www.yahoo.it""http://www.yahoo.it"];
    var 
    um6_array:Array = ["http://www.google.it""http://www.yahoo.it""http://www.yahoo.it""http://www.yahoo.it"];
    // Functions ------------------------------------------------------------------------
    _global.$tweenManager.broadcastEvents true;
    // Main menu
    function createMainMenu() {
        var 
    1;
        var 
    total mm_array.length;
        while (
    a<=total) {
            
    ypos = ((a-1)*homm)+1;
            
    attachMovie("mainnav_mc""mainnav"+a+"_mc"this.getNextHighestDepth()+100, {_x:0_y:ypos});
            
    // attach the movieClip
            
    var nc this["mainnav"+a+"_mc"];
            
    nc.menutext mm_array[(a-1)];
            
    // set the title text for each button
            
    nc.itemnum a;
            
    // set the menu #
            
    a++;
        }
    }
    function 
    moveMenu(num) {
        if ((
    _root.collapsed == true) || (_root.selectedmenu != num)) {
            var array = 
    "sm"+num+"_array";
            var 
    totalsm = eval(array).length;
            var 
    totalmm mm_array.length;
            var 
    1;
            while (
    a<=totalmm) {
                
    mc this["mainnav"+a+"_mc"];
                if (
    a>num) {
                    var 
    ypos = (((a-1)*homm)+1)+totalsm*(hosm+1);
                    
    mc.tween("_y"ypos0.5"easeOutCubic");
                } else {
                    var 
    ypos = ((a-1)*homm)+1;
                    if (
    == num) {
                        
    nypos ypos;
                        
    mc.tween("_y"ypos0.5"easeOutCubic"0onEnd(numnypos));
                    } else {
                        
    mc.tween("_y"ypos0.5"easeOutCubic");
                    }
                }
                
    a++;
            }
            
    _root.collapsed false;
        } else {
            
    contractMenu();
            
    _root.collapsed true;
        }
    }
    function 
    onEnd(numnypos) {
        
    _root.num num;
        
    createSubMenu(numnypos);
    }
    function 
    contractMenu() {
        var 
    1;
        while (
    c<=submenu_array.length) {
            
    removeMovieClip("subnav"+c+"_mc");
            
    removeMovieClip("mask"+c+"_mc");
            
    c++;
        }
        var 
    1;
        while (
    g<=mm_array.length) {
            
    ypos = ((g-1)*homm)+1;
            
    this["mainnav"+g+"_mc"].tween("_y"ypos0.5"easeOutCubic");
            
    g++;
        }
    }
    function 
    createSubMenu(numnypos) {
        var array = 
    "sm"+num+"_array";
        var 
    links "um"+num+"_array";
        var 
    totalsm = eval(array).length;
        var 
    ypos nypos+4;
        var 
    1;
        while (
    c<=submenu_array.length) {
            
    removeMovieClip("subnav"+c+"_mc");
            
    removeMovieClip("mask"+c+"_mc");
            
    c++;
        }
        
    submenu_array = [];
        var 
    1;
        while (
    a<=totalsm) {
            
    ypos ypos+hosm+1;
            
    attachMovie("subnav_mc""subnav"+a+"_mc"a+30, {_x:0_y:ypos});
            if (
    num != mm_array.length) {
                
    attachMovie("mask_mc""mask"+a+"_mc"a+990, {_x:0_y:0});
                
    mask_mc this["mask"+a+"_mc"];
                
    mask_mc._alpha 10;
                
    mask_mc.onEnterFrame = function() {
                    
    this._height _parent.container_mc["mainnav"+mm_array.length+"_mc"]._y;
                };
                
    this["subnav"+a+"_mc"].setMask(mask_mc);
            }
            
    nc this["subnav"+a+"_mc"];
            
    nc._alpha 0;
            
    nc.itemnum a;
            
    nc.menutext = eval(array)[(a-1)];
            
    nc.alphaTo(1002);
            
    nc.theURL links[a]
            
    nc.onRelease = function() {
                
    getURL(this.theURL"_self");
            };
            
    submenu_array.push("subnav"+a+"_mc");
            
    a++;
        }
    }
    // Build Menu -----------------------------------------------------------------------
    _root.collapsed true;
    createMainMenu(); 

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.