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

    [AS2] Xml passaggio variabile ad una funzione

    Salve ragazzi,
    ho un problema con la mia sintassi AS2 probabilmente banale per i più esperti ma irrisolvibile per me che sono abbastanza "niuwembaro", provo a spiegarmi:

    dal mio solito file xml carico, all'interno di un MC, delle informazioni di varia natura che utilizzo per crearmi una sorta di elenco, tramite una funzione (onrelase) cliccando su una delle voci vorrei passare le variabili dell'XML ad un secondo movieclip. Ho scritto cosi:

    codice:
    function Veditesto()
    {
    	var caricaXML:XML = new XML();
    	caricaXML.ignoreWhite = true;
    	caricaXML.onLoad = leggiXML;
    	caricaXML.load(_global.Path + "sources/text_portfolio.xml");
    	var posInit = item_mc._y;
    	
    	function leggiXML(succes:Boolean) {
    		
    	if (succes == true) {
    		
    		var id:Array = [];
    		var descrizione:Array = [];
    		var titolo:Array = [];
    		var tempArray:Array = new Array();
    		var tempArray = this.firstChild.childNodes;
    		
    		tekstcont_mc = tempRoot.attachMovie("tekstcont2ID", "tekstcontmc", tempRoot.getNextHighestDepth());
    		tekstcont_mc._x = 585;
    		tekstcont_mc._y = 44;
    		var _loc6 = 0;
    		var _loc4 = 0;
    		var _loc12 = 15;
    		
    		tekstcont_mc.titel_txt.autoSize = true;
    		tekstcont_mc.titel_txt.htmlText = ["il portfolio dei nostri lavori"];
    		
    		for (var i:Number = 0; i<tempArray.length; i++) 
    		{
    			id[i] = tempArray[i].childNodes[0].attributes.prezzo;
    			descrizione[i] = tempArray[i].childNodes[0].firstChild.firstChild;
    			titolo[i] = tempArray[i].childNodes[0].firstChild.attributes.titolo;
    			
    			_loc5 = tekstcont_mc.tekst_mc.getNextHighestDepth();
    			tekstitem_mc = tekstcont_mc.tekst_mc.attachMovie("tekstitem6ID", "tekstitem" + i + "_mc", _loc5);
    			tekstitem_mc._x = _loc6;
    			tekstitem_mc._y = _loc4;
    			tekstitem_mc.deeplink = _global.knoppen_arr[_global.curID].deeplink + eval(prezzo[i]) + "/";
    			trace(_global.knoppen_arr[_global.curID].deeplink);
    			tekstitem_mc.deeplink = prezzo[i] + "/";
    			tekstitem_mc.titel_txt.htmlText = titolo[i];
    			
    			
    			tekstitem_mc.onRelease = function() 
    			{
    				var _loc5 = tekstcont_mc.getNextHighestDepth();
            		terug_mc = tekstcont_mc.attachMovie("terugID", "terugmc", _loc5);
            		terug_mc._x = 333;
            		var _loc9 = [{label_it: "indietro >", label_fr: "retournez >", label_en: "go back >"}];
    				terug_mc.label_txt.autoSize = true;
    				terug_mc.label_txt.htmlText = _loc9[0]["label_" + _global.taal];
    				terug_mc.deeplink = _global.knoppen_arr[_global.curID].deeplink;
            		
    				tekstcont_mc.tekst_mc._visible = false;
    				tekstcont_mc.titel_txt._visible = false;
    				
    				tekstcont_mc = tempRoot.attachMovie("tekstcont1ID", "tekstcontmc", tempRoot.getNextHighestDepth());
    				tekstcont_mc.titel_txt.autoSize = true;
    				tekstcont_mc.titel_txt.htmlText = titolo[i];
    				tekstcont_mc.tekst_mc.tekst_txt._y = posY;
    				tekstcont_mc.tekst_mc.tekst_txt.autoSize = true;
    				tekstcont_mc.tekst_mc.tekst_txt.htmlText = descrizione[i];
    				tekstcont_mc.tekst_mc.tekst_txt.styleSheet = _global.css_obj;
    				tekstcont_mc.tekst_mc.tekst_txt._width = tekstcont_mc.mask_mc._width;
    				tekstcont_mc._x = 585;
    				tekstcont_mc._y = 42;
    			};//End Function  
    			
    			_loc4 = _loc4 + tekstitem_mc._height;
    		} // end of for
    
    		if (tekstcont_mc.tekst_mc._height < tekstcont_mc.mask_mc._height)
    		{
    			tekstcont_mc.dragger_mc._visible = tekstcont_mc.scroller_mc._visible = false;
    		}
    		else
    		{
    			Root.vscrolling(tekstcont_mc.tekst_mc, tekstcont_mc.mask_mc, tekstcont_mc.scroller_mc, tekstcont_mc.dragger_mc);
    		} // end else if
    	}// End Success	
    	}// End Success	
    } // End of the function
    Quella scritta in blu è la funzione che apre il secondo movieclip, il problema è che all'interno di essa le variabili titolo e descrizione risultano indefinite. Dove sbaglio?

  2. #2
    prova cosi...
    Codice PHP:
    tekstitem_mc.deeplink prezzo[i] + "/";
                
    tekstitem_mc.titel_txt.htmlText titolo[i];
                
    tekstitem_mc.num=i;
                
                
    tekstitem_mc.onRelease = function() 
                {
                    var 
    _loc5 tekstcont_mc.getNextHighestDepth();
                    
    terug_mc tekstcont_mc.attachMovie("terugID""terugmc"_loc5);
                    
    terug_mc._x 333;
                    var 
    _loc9 = [{label_it"indietro >"label_fr"retournez >"label_en"go back >"}];
                    
    terug_mc.label_txt.autoSize true;
                    
    terug_mc.label_txt.htmlText _loc9[0]["label_" _global.taal];
                    
    terug_mc.deeplink _global.knoppen_arr[_global.curID].deeplink;
                    
                    
    tekstcont_mc.tekst_mc._visible false;
                    
    tekstcont_mc.titel_txt._visible false;
                    
                    
    tekstcont_mc tempRoot.attachMovie("tekstcont1ID""tekstcontmc"tempRoot.getNextHighestDepth());
                    
    tekstcont_mc.titel_txt.autoSize true;
                    
    tekstcont_mc.titel_txt.htmlText titolo[this.num];
                    
    tekstcont_mc.tekst_mc.tekst_txt._y posY;
                    
    tekstcont_mc.tekst_mc.tekst_txt.autoSize true;
                    
    tekstcont_mc.tekst_mc.tekst_txt.htmlText descrizione[this.num];
                    
    tekstcont_mc.tekst_mc.tekst_txt.styleSheet _global.css_obj;
                    
    tekstcont_mc.tekst_mc.tekst_txt._width tekstcont_mc.mask_mc._width;
                    
    tekstcont_mc._x 585;
                    
    tekstcont_mc._y 42;
                };
    //End Function 
    la verità non è una meretrice che si getta al collo di chi non la vuole ma anzi essa è dotata di una così altera bellezza che anche chi sacrifica tutto per ottenerla non è sicuro di averla raggiunta !

  3. #3
    Ciao Crescenzo,
    grazie mille: FUNZIONA!!! Solo se posso approfittare ancora della tua disponibilità mi sto imbattendo in un secondo problema che non riesco a comprendere: ho aggiunto una sintassi per lo scroll e il drag della finestra che contiene il testo in coda alla funzione che è sopra, così:

    codice:
    if (tekstcont_mc.tekst_mc._height < tekstcont_mc.mask_mc._height)
    {
    	tekstcont_mc.dragger_mc._visible = tekstcont_mc.scroller_mc._visible = false;
    }
    else
    {
    	Root.vscrolling(tekstcont_mc.tekst_mc, tekstcont_mc.mask_mc, tekstcont_mc.scroller_mc, tekstcont_mc.dragger_mc);
    } // end else if
    Lo scroll con la rotella del mouse funziona perfettamente mentre il drag non funziona, da cosa può dipendere?

  4. #4
    quale drag scusa ..dove sta?

    :master:

    la verità non è una meretrice che si getta al collo di chi non la vuole ma anzi essa è dotata di una così altera bellezza che anche chi sacrifica tutto per ottenerla non è sicuro di averla raggiunta !

  5. #5
    Sorry non il drag ma lo scrolling

  6. #6
    Originariamente inviato da Descendz
    Sorry non il drag ma lo scrolling
    ma il codice dello scrolling dove sta?
    la verità non è una meretrice che si getta al collo di chi non la vuole ma anzi essa è dotata di una così altera bellezza che anche chi sacrifica tutto per ottenerla non è sicuro di averla raggiunta !

  7. #7
    ho inserito un bottone per tornare all'elenco, ho fatto una cosa del genere:
    codice:
    					var _loc5 = tekstcont_mc.getNextHighestDepth();
    					terug_mc = tekstcont_mc.attachMovie("terugID", "terugmc", _loc5);
    					terug_mc._x = 333;
    					var _loc9 = [{label_it: "indietro >", label_fr: "retournez >", label_en: "go back >"}];
    					terug_mc.label_txt.autoSize = true;
    					terug_mc.label_txt.htmlText = ["indietro >"];
    					terug_mc.deeplink = _global.knoppen_arr[_global.curID].deeplink;
    					
    					terug_mc.onRelease = function()
    					{
    						tekstcont_mc._visible = false;
    						terug_mc._visible = false;
    						zetRest();
    						ApriXML();
    					};
    Quando clicco sulla prima voce del menu funziona tutto ok, sulla seconda, invece, se torno indietro mi si blocca la riproduzione dello slide, qualcuno sa suggerirmi dove sbaglio?!

  8. #8
    hai mica un link x vedere di cosa stiamo parlando e magari il problema......che nn ho capito bene...
    la verità non è una meretrice che si getta al collo di chi non la vuole ma anzi essa è dotata di una così altera bellezza che anche chi sacrifica tutto per ottenerla non è sicuro di averla raggiunta !

  9. #9
    ti ho inviato un pm!

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.