Visualizzazione dei risultati da 1 a 4 su 4
  1. #1
    Utente di HTML.it
    Registrato dal
    Dec 2003
    Messaggi
    194

    associare swf esterno in una clip vuota tramite xml

    come si carica un swf esterno con xml?

    nel xml c'è:
    codice:
    <ITEM id="homepage" page="pagina1.html" tg="_blank" swf="vuoto.swf">Pagina principale ...</ITEM>
    in flash come associo "vuoto.swf" in un movieclip vuoto?

  2. #2
    Utente di HTML.it L'avatar di ilpiubello
    Registrato dal
    May 2000
    Messaggi
    2,685
    Una volta che carichi il file xml basta che risali al childnode e all'attributo "swf" poi:

    load_filmato=nodo.attributes.swf;

    loadMovie(load_filmato);
    FaX

  3. #3
    Utente di HTML.it
    Registrato dal
    Dec 2003
    Messaggi
    194
    questo è il codice della mia pagina.
    come lo adatto al mio codice?
    in flash "Foto" è il nome della clip vuota


    codice:
    // Constructor
    _global.Menu = function(data_file, ref) {
    	// Set the menu reference
    	this._p = ref;
    	// Read the menu info from the xml file
    	this.XmlData = new XML();
    	this.XmlData.ignoreWhite = true;
    	this.XmlData._p = this;
    	this.XmlData.load(data_file);
    	this.XmlData.onLoad = function(ok) {
    		if (ok) {
    			this._p.SetVariables();
    		}
    	};
    	delete ref;
    	delete data_file;
    };
    // Parse the information loaded
    Menu.prototype.SetVariables = function() {
    	// Set the vars readed from the xml file
    	this.Root = this.XmlData.childNodes;
    	this.Titles = new Array();
    	
    	this.Foto = new Array();	
    		
    	this.Links = new Array();
    	this.Tg = new Array();
    	this.Descriptions = new Array();
    	for (i=0; i<this.Root.length; i++) {
    		if (this.Root[i].nodeName.toUpperCase() == "MENU") {
    			this.Nodes = this.Root[i].childNodes;
    			for (k=0; k<this.Nodes.length; k++) {
    				this.Item++;
    				this.Titles.push(this.Nodes[k].attributes.id.toString());
    				
    				this.Foto.push(this.Nodes[k].attributes.swf.toString());
    				
    				this.Links.push(this.Nodes[k].attributes.page.toString());
    				this.Tg.push(this.Nodes[k].attributes.tg.toString());
    				this.Descriptions.push(this.Nodes[k].childNodes.toString());
    			}
    		}
    	}
    	delete this.Root;
    	delete this.Nodes;
    	delete this.XmlData;
    	this.DrawMenu();
    };
    // Construct the UI
    Menu.prototype.DrawMenu = function() {
    	// Use vars and arrays to contruct the menu
    	for (i=0; i<this.Item; i++) {
    		this._p.attachMovie("ITEM", "Item" add i, i);
    		this._mc = eval(this._p add ".Item" add i);
    		this._mc._x = 0;
    		this._mc._y = 323+21*i;
    		this._mc.Title.label.htmlText = this.Titles[i].toUpperCase();
    
    		this._mc.Foto.$swf = this.Foto[i];
    		
    		this._mc.Graphic.Slide.label.htmlText = this.Titles[i].toUpperCase();
    		this._mc.Link.Description.htmlText = "" add this.Descriptions[i];
    		this._mc.Link.$link = this.Links[i];
    		this._mc.Link.$tg = this.Tg[i];
    		this.format = new TextFormat();
    		this.format.align = "left";
    		this._mc.Title.label.setTextFormat(this.format);
    		this._mc._id = i;
    		delete this.format;
    	}
    	this.SetAction();
    	this.SetActive(0);
    };
    // Set the action for the menu tabs
    Menu.prototype.SetAction = function() {
    	for (i in this.Titles) {
    		this._mc = eval(this._p add ".Item" add i);
    		this._mc._ref = this;
    		this._mc.$active = (i == 0) ? true : false;
    		this._mc.Ico.gotoAndPlay((i == 0) ? "SlideIn" : "SlideOut");
    		this._mc.onRelease = function() {
    			if (this.$active == false) {
    				this._ref.SetActive(this._id);
    			}
    		};
    		this._mc.Link.onMouseUp = function () {
    			if (this.hitTest(_xmouse, _ymouse, true) && (this._parent.$active == true)) {
    				getURL(this.$Link, this.$Tg);
    			}
    		}
    	}
    };
    // Set the visualization options
    Menu.prototype.SetActive = function(id) {
    	for (i in this.Titles) {
    		this._mc = eval(this._p add ".Item" add i);
    		// Move Title And Graphics of the Mc
    		this._mc.Ico.gotoAndPlay((id == i) ? "SlideIn" : (this._mc._currentframe != 1 && this._mc.$active == true) ? "SlideOut" : null);
    		this._mc.gotoAndPlay((id == i) ? "UnActive" : (this._mc._currentframe == 1) ? "Stop" : (this._mc.$active == true) ? "Active" : null);
    		this._mc.$active = (id == i) ? true : (this._mc._currentframe == 1) ? this._mc.$active : false;
    		// Move the tabs (with easing) in the correct position
    		if (id<i) {
    			// Move top to bottom
    			if (this._mc.act != "GoToBt") {
    				this._mc.__t__ = 0;
    				this._mc.act = "GoToBt";
    				delete this._mc.onEnterFrame;
    				this._mc.onEnterFrame = function() {
    					if (this._y == (21*this._id+323)) {
    						delete this.onEnterFrame;
    						this.act = "";
    						delete this._mc._x0;
    						delete this._mc._y0;
    						delete this._mc._x1;
    						delete this._mc._y1;
    						delete this._mc.spd;
    						delete this._mc.__t__;
    					}
    					this.moveFromTo(this._x, this._y, this._x, (21*this._id+323), 0.02);
    				};
    			}
    		} else if (id>=i) {
    			// Move bottom to top
    			if (this._mc.act != "GoToTp") {
    				this._mc.__t__ = 0;
    				this._mc.act = "GoToTp";
    				delete this._mc.onEnterFrame;
    				this._mc.onEnterFrame = function() {
    					if (this._y == 21*this._id) {
    						delete this.onEnterFrame;
    						this.act = "";
    						delete this._mc._x0;
    						delete this._mc._y0;
    						delete this._mc._x1;
    						delete this._mc._y1;
    						delete this._mc.spd;
    						delete this._mc.__t__;
    					}
    					this.moveFromTo(this._x, this._y, this._x, 21*this._id, 0.02);
    				};
    			}
    		}
    	}
    	delete id;
    };
    MovieClip.prototype.moveFromTo = function(xFrom, yFrom, xTo, yTo, speed) {
    	this.x0 = xFrom == undefined ? this._x : xFrom;
    	this.y0 = yFrom == undefined ? this._y : yFrom;
    	this.x1 = xTo == undefined ? xFrom : xTo;
    	this.y1 = yTo == undefined ? yFrom : yTo;
    	this.spd = speed == undefined || speed>1 ? 0.0120 : speed;
    	this.__t__ += this.spd;
    	this._x = Math.round(this.x0+(this.x1-this.x0)*this.__t__);
    	this._y = Math.round(this.y0+(this.y1-this.y0)*this.__t__);
    };

  4. #4
    Utente di HTML.it
    Registrato dal
    Dec 2003
    Messaggi
    194
    con il tuo codice funziona quasi
    come mai mi legge solo l'ultimo valore "swf" del xml?



    codice:
    // Constructor
    _global.Menu = function(data_file, ref) {
    	// Set the menu reference
    	this._p = ref;
    	// Read the menu info from the xml file
    	this.XmlData = new XML();
    	this.XmlData.ignoreWhite = true;
    	this.XmlData._p = this;
    	this.XmlData.load(data_file);
    	this.XmlData.onLoad = function(ok) {
    		if (ok) {
    			this._p.SetVariables();
    		}
    	};
    	delete ref;
    	delete data_file;
    };
    // Parse the information loaded
    Menu.prototype.SetVariables = function() {
    	// Set the vars readed from the xml file
    	this.Root = this.XmlData.childNodes;
    	this.Titles = new Array();
    	
    	this.Fotos = new Array();	
    	
    	this.Links = new Array();
    	this.Tg = new Array();
    	this.Descriptions = new Array();
    	for (i=0; i<this.Root.length; i++) {
    		if (this.Root[i].nodeName.toUpperCase() == "MENU") {
    			this.Nodes = this.Root[i].childNodes;
    			for (k=0; k<this.Nodes.length; k++) {
    				this.Item++;
    				this.Titles.push(this.Nodes[k].attributes.id.toString());
    
    				this.Fotos.push(this.Nodes[k].attributes.swf.toString());
    								
    				this.Links.push(this.Nodes[k].attributes.page.toString());
    				this.Tg.push(this.Nodes[k].attributes.tg.toString());
    				this.Descriptions.push(this.Nodes[k].childNodes.toString());
    			}
    		}
    	}
    	delete this.Root;
    	delete this.Nodes;
    	delete this.XmlData;
    	this.DrawMenu();
    };
    // Construct the UI
    Menu.prototype.DrawMenu = function() {
    	// Use vars and arrays to contruct the menu
    	for (i=0; i<this.Item; i++) {
    		this._p.attachMovie("ITEM", "Item" add i, i);
    		this._mc = eval(this._p add ".Item" add i);
    		this._mc._x = 0;
    		this._mc._y = 323+21*i;
    		this._mc.Title.label.htmlText = this.Titles[i].toUpperCase();
    		
    		this._mc.Foto.$swf = this.Fotos[i];
    		load_filmato = this.Fotos[i];
    		
    		this._mc.Graphic.Slide.label.htmlText = this.Titles[i].toUpperCase();
    		this._mc.Link.Description.htmlText = "" add this.Descriptions[i];
    		this._mc.Link.$link = this.Links[i];
    		this._mc.Link.$tg = this.Tg[i];
    		this.format = new TextFormat();
    		this.format.align = "left";
    		this._mc.Title.label.setTextFormat(this.format);
    		this._mc._id = i;
    		delete this.format;
    	}
    	this.SetAction();
    	this.SetActive(0);
    };
    // Set the action for the menu tabs
    Menu.prototype.SetAction = function() {
    	for (i in this.Titles) {
    		this._mc = eval(this._p add ".Item" add i);
    		this._mc._ref = this;
    		this._mc.$active = (i == 0) ? true : false;
    		this._mc.Ico.gotoAndPlay((i == 0) ? "SlideIn" : "SlideOut");
    		this._mc.onRelease = function() {
    			if (this.$active == false) {
    				this._ref.SetActive(this._id);
    			}
    		};
    		this._mc.Link.onMouseUp = function () {
    			if (this.hitTest(_xmouse, _ymouse, true) && (this._parent.$active == true)) {
    				getURL(this.$Link, this.$Tg);
    			}
    		}
    	}
    };
    // Set the visualization options
    Menu.prototype.SetActive = function(id) {
    	for (i in this.Titles) {
    		this._mc = eval(this._p add ".Item" add i);
    		// Move Title And Graphics of the Mc
    		this._mc.Ico.gotoAndPlay((id == i) ? "SlideIn" : (this._mc._currentframe != 1 && this._mc.$active == true) ? "SlideOut" : null);
    		this._mc.gotoAndPlay((id == i) ? "UnActive" : (this._mc._currentframe == 1) ? "Stop" : (this._mc.$active == true) ? "Active" : null);
    		this._mc.$active = (id == i) ? true : (this._mc._currentframe == 1) ? this._mc.$active : false;
    		// Move the tabs (with easing) in the correct position
    		
    		loadMovieNum(load_filmato,2);	
    		
    		if (id<i) {
    			// Move top to bottom
    			if (this._mc.act != "GoToBt") {
    				this._mc.__t__ = 0;
    				this._mc.act = "GoToBt";
    				delete this._mc.onEnterFrame;
    				this._mc.onEnterFrame = function() {
    					if (this._y == (21*this._id+323)) {
    						delete this.onEnterFrame;
    						this.act = "";
    						delete this._mc._x0;
    						delete this._mc._y0;
    						delete this._mc._x1;
    						delete this._mc._y1;
    						delete this._mc.spd;
    						delete this._mc.__t__;
    					}
    					this.moveFromTo(this._x, this._y, this._x, (21*this._id+323), 0.02);
    				};
    			}
    		} else if (id>=i) {
    			// Move bottom to top
    			if (this._mc.act != "GoToTp") {
    				this._mc.__t__ = 0;
    				this._mc.act = "GoToTp";
    				delete this._mc.onEnterFrame;
    				this._mc.onEnterFrame = function() {
    					if (this._y == 21*this._id) {
    						delete this.onEnterFrame;
    						this.act = "";
    						delete this._mc._x0;
    						delete this._mc._y0;
    						delete this._mc._x1;
    						delete this._mc._y1;
    						delete this._mc.spd;
    						delete this._mc.__t__;
    					}
    					this.moveFromTo(this._x, this._y, this._x, 21*this._id, 0.02);
    				};
    			}
    		}
    	}
    	delete id;
    };
    MovieClip.prototype.moveFromTo = function(xFrom, yFrom, xTo, yTo, speed) {
    	this.x0 = xFrom == undefined ? this._x : xFrom;
    	this.y0 = yFrom == undefined ? this._y : yFrom;
    	this.x1 = xTo == undefined ? xFrom : xTo;
    	this.y1 = yTo == undefined ? yFrom : yTo;
    	this.spd = speed == undefined || speed>1 ? 0.0120 : speed;
    	this.__t__ += this.spd;
    	this._x = Math.round(this.x0+(this.x1-this.x0)*this.__t__);
    	this._y = Math.round(this.y0+(this.y1-this.y0)*this.__t__);
    };

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.