Visualizzazione dei risultati da 1 a 2 su 2
  1. #1

    apertura e chiusura menù

    Salve, sto cercando di realizzare un semplice menù a tendina:
    codice:
    var stato = 0
    _root.notizie_mc.notizie_btn.onRelease = function() {
    	
    	if (stato == 0) {
    		
    		_root.notizie_mc.gotoAndPlay("on");
    		stato = 1;
    	}
    	if (stato == 1) {
    
    
    		_root.notizie_mc.gotoAndPlay("off");
    		stato = 0;
    
    	}
    };
    _root.notizie_mc.societa_btn.onRelease = function() {
    	
    	if (stato == 0) {
    		
    		_root.societa_mc.gotoAndPlay("on");
    		stato = 1;
    	}
    	if (stato == 1) {
    
    
    		_root.societa_mc.gotoAndPlay("off");
    		stato = 0;
    
    	}
    };
    Singolarmente i pulsanti funzionano, vale a dire cliccando sul pulsante notizie mi apre il sottomenù, ricliccandoci me lo chiude. Però io vorre fare in modo che quando clicco sul pulsante societa venga chiuso il settomenù di notizie e viceversa. Qual'è la logica da seguire?

  2. #2
    ho risolto cosi :
    codice:
    stop();
    var stato:String = "0";
    stato_txt.text = stato;
    var aperto:String;
    function ControllaMenu() {
    	if (stato == "0") {
    		switch (aperto) {
    		case "notizie" :
    			_root.notizie_mc.gotoAndPlay("on");
    			_root.societa_mc.gotoAndPlay("chiudi");
    			_root.squadra_mc.gotoAndPlay("chiudi");
    			_root.stagione_mc.gotoAndPlay("chiudi");
    			_root.stadio_mc.gotoAndPlay("chiudi");
    			_root.territorio_mc.gotoAndPlay("chiudi");
    			break;
    		case "societa" :
    			_root.notizie_mc.gotoAndPlay("chiudi");
    			_root.societa_mc.gotoAndPlay("on");
    			_root.squadra_mc.gotoAndPlay("chiudi");
    			_root.stagione_mc.gotoAndPlay("chiudi");
    			_root.stadio_mc.gotoAndPlay("chiudi");
    			_root.territorio_mc.gotoAndPlay("chiudi");
    			break;
    		case "squadra" :
    			_root.notizie_mc.gotoAndPlay("chiudi");
    			_root.societa_mc.gotoAndPlay("chiudi");
    			_root.squadra_mc.gotoAndPlay("on");
    			_root.stagione_mc.gotoAndPlay("chiudi");
    			_root.stadio_mc.gotoAndPlay("chiudi");
    			_root.territorio_mc.gotoAndPlay("chiudi");
    			break;
    		case "stagione" :
    			_root.notizie_mc.gotoAndPlay("chiudi");
    			_root.societa_mc.gotoAndPlay("chiudi");
    			_root.squadra_mc.gotoAndPlay("chiudi");
    			_root.stadio_mc.gotoAndPlay("chiudi");
    			_root.stagione_mc.gotoAndPlay("on");
    			_root.territorio_mc.gotoAndPlay("chiudi");
    			break;
    		case "stadio" :
    			_root.notizie_mc.gotoAndPlay("chiudi");
    			_root.societa_mc.gotoAndPlay("chiudi");
    			_root.squadra_mc.gotoAndPlay("chiudi");
    			_root.stadio_mc.gotoAndPlay("on");
    			_root.stagione_mc.gotoAndPlay("chiudi");
    			_root.territorio_mc.gotoAndPlay("chiudi");
    			break;
    		case "territorio" :
    			_root.notizie_mc.gotoAndPlay("chiudi");
    			_root.societa_mc.gotoAndPlay("chiudi");
    			_root.squadra_mc.gotoAndPlay("chiudi");
    			_root.stadio_mc.gotoAndPlay("chiudi");
    			_root.stagione_mc.gotoAndPlay("chiudi");
    			_root.territorio_mc.gotoAndPlay("on");
    			break;
    		}
    	}
    }
    _root.notizie_mc.notizie_btn.onRelease = function() {
    	aperto = "notizie";
    	ControllaMenu();
    };
    _root.societa_mc.societa_btn.onRelease = function() {
    	aperto = "societa";
    	ControllaMenu();
    };
    _root.squadra_mc.squadra_btn.onRelease = function() {
    	aperto = "squadra";
    	ControllaMenu();
    };
    _root.stagione_mc.stagione_btn.onRelease = function() {
    	aperto = "stagione";
    	ControllaMenu();
    };
    _root.stadio_mc.stadio_btn.onRelease = function() {
    	aperto = "stadio";
    	ControllaMenu();
    };
    _root.giovanili_mc.giovanili_btn.onRelease = function() {
    };
    _root.scuolacalcio_mc.scuolacalcio_btn.onRelease = function() {
    	getURL("javascript:finestra('pop/pop2.asp?a=../scuola-calcio/scuola-calcio.htm&b=../foto/foto-giovanili.htm&f=scuola-calcio')");
    };
    _root.territorio_mc.territorio_btn.onRelease = function() {
    	aperto = "territorio";
    	ControllaMenu();
    };
    _root.contatti_mc.contatti_btn.onRelease = function() {
    	getURL("javascript:finestra('pop/pop.asp?a=../contatti/contatti.htm&f=contatti')");
    };
    _root.credits_mc.credits_btn.onRelease = function() {
    	getURL("javascript:finestra('pop/pop.asp?a=../credits/credits.htm&f=credits')");
    };
    se clicco su un bottone mi apre il menu, che si chiude se clicco su un altro bottone. Fin qui tutto ok, vorrei fare però in modo che quando clicco sul bottone che ha già aperto il sotto menu questo venga chiuso

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 © 2026 vBulletin Solutions, Inc. All rights reserved.