Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 14
  1. #1

    modifiche script per menu flash

    lo script seguente viene richiamato in un file flash per la realizzazione di un menù (scaricato dalla libreria di flash-mx.it).
    il file fla richiama anche un file xml che contiene il testo dei vari link del menu.

    io vorrei aggiungere i collegamenti ipertestuali che non sono previsti, ma non so come fare. chi mi aiuta a modificare lo script seguente?
    grazie mille

    /* #####################################
    » Menu Class
    Written by: CyberPunk
    Release Date: 9/4/03
    Contact: alessandro.bianco@visual-emotion.it
    ##################################### */
    // 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.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.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 = 174+21*i;
    this._mc.Title.label.htmlText = this.Titles[i].toUpperCase();
    this._mc.Graphic.Slide.label.htmlText = this.Titles[i].toUpperCase();
    this._mc.Description.htmlText = "» " add this.Descriptions[i];
    this.format = new TextFormat();
    this.format.align = "right";
    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);
    }
    };
    }
    };
    // 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+174)) {
    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+174), 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+1) {
    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+1, 0.02);
    };
    }
    }
    }
    delete id;
    };
    // Move Clips (written by gdeparta@yahoo.com )
    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.0125 : 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__);
    };
    ranACIDA against chloroformic minds

  2. #2
    a parte che è un papiro.. che arrivo in fondo e la rotella del mouse è stanca

    se mi dici che il text dei link è nel file XML..
    è nel tuo file xml che devi mettere i collegamenti..
    proprio come fai solitamente con HTML href=ecc..

    dimmi se ho capito

    ciao
    Interactive Html/CSS/JS Playground | @webbeloz ( cip..cip! )
    Mechanics & Expert Tuning Fix Z3 Roadster Community

  3. #3
    ho provato a mettere il link nel file xml, come sotto, ma non va........sapresti aiutarmi? ti prego......

    <?xml version="1.0"?>
    <MENU>
    <ITEM id="home" link="http://www.kreativamente.com">Pagina principale ...</ITEM>
    <ITEM id="works">I miei lavori, esperimenti e progetti</ITEM>
    <ITEM id="curriculum">Il mio curriculum</ITEM>
    <ITEM id="friends">Pagina dedicata agli amici</ITEM>
    <ITEM id="credits">Onore e gloria a ...</ITEM>
    <ITEM id="contact">Come contattarmi ...</ITEM>
    <ITEM id="links">Siti utili ...</ITEM>
    </MENU>
    ranACIDA against chloroformic minds

  4. #4
    posta il testo XML nella sua versione originale..
    come lo era prima delle modifiche!

    ciao
    Interactive Html/CSS/JS Playground | @webbeloz ( cip..cip! )
    Mechanics & Expert Tuning Fix Z3 Roadster Community

  5. #5
    nello script originario è scritto:
    codice:
    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);
    			}
    		}
    	} 
    };
    che fa in modo che se clicchi sulla descrizione es:"Pagina principale..." si apre la pagina relativa...
    la cosa è poco intuitiva perché non compare nessuna manina.
    [Il mio sito V2]
    ___________________
    I.m.The.Magic.Man

  6. #6
    questo è l' AS di flash..

    il file esterno XML invece?
    Interactive Html/CSS/JS Playground | @webbeloz ( cip..cip! )
    Mechanics & Expert Tuning Fix Z3 Roadster Community

  7. #7
    questo é xml originario.

    <?xml version="1.0"?>
    <MENU>
    <ITEM id="home" >Pagina principale ...</ITEM>
    <ITEM id="works">I miei lavori, esperimenti e progetti</ITEM>
    <ITEM id="curriculum">Il mio curriculum</ITEM>
    <ITEM id="friends">Pagina dedicata agli amici</ITEM>
    <ITEM id="credits">Onore e gloria a ...</ITEM>
    <ITEM id="contact">Come contattarmi ...</ITEM>
    <ITEM id="links">Siti utili ...</ITEM>
    </MENU>
    ranACIDA against chloroformic minds

  8. #8
    mi sambra che sia questo:

    codice:
    <?xml version="1.0"?>
    <MENU>
        <ITEM id="home" page="pagina1.html" tg="_blank">Pagina principale ...</ITEM>
        <ITEM id="works" page="pagina2.html" tg="_blank">I miei lavori, esperimenti e progetti</ITEM>
        <ITEM id="curriculum" page="pagina3.html" tg="_blank">Il mio curriculum</ITEM>
        <ITEM id="friends" page="pagina4.html" tg="_blank">Pagina dedicata agli amici</ITEM>
        <ITEM id="credits" page="pagina5.html" tg="_blank">Onore e gloria a ...</ITEM>
        <ITEM id="contact" page="pagina6.html" tg="_blank">Come contattarmi ...</ITEM>
    </MENU>
    [Il mio sito V2]
    ___________________
    I.m.The.Magic.Man

  9. #9
    e lo script che ho scaricato io è:

    codice:
    /* #####################################
    	» Menu Class
    	Written by: CyberPunk
    	Release Date: 9/4/03
    	Contact: alessandro.bianco@visual-emotion.it
    ##################################### */
    // 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.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.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 = 174+21*i;
    		this._mc.Title.label.htmlText = this.Titles[i].toUpperCase();
    		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 = "right";
    		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+174)) {
    						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+174), 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;
    };
    // Move Clips (written by gdeparta@yahoo.com )
    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.0125 : 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__);
    };
    [Il mio sito V2]
    ___________________
    I.m.The.Magic.Man

  10. #10
    ma qui siete in due..

    qualcosa non quadra! uhmm..
    Interactive Html/CSS/JS Playground | @webbeloz ( cip..cip! )
    Mechanics & Expert Tuning Fix Z3 Roadster Community

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