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

    Aggiungere una variabile nell'XML

    Ciao a tutti....vengo al punto!!!

    Ho il mio file xml fatto così:
    -------------------------------------------------------------------
    <?xml version="1.0"?>
    <RSS PAUSE="10000">
    <IMAGE TRANSITION="7">images/1.jpg</IMAGE>
    <IMAGE TRANSITION="7">images/2.jpg</IMAGE>
    <IMAGE TRANSITION="7">images/3.jpg</IMAGE>
    </RSS>
    -------------------------------------------------------------------
    e nel mio filamto ho questo script:
    -------------------------------------------------------------------
    #initclip 1
    ImageFader = function () {
    this.__init__ ();
    };
    ImageFader.prototype = new MovieClip ();
    // ** init class ** //
    ImageFader.prototype.__init__ = function () {
    this._xscale = 100
    this._yscale = 100
    this.bounding_box.unloadMovie()
    this._fader_.unloadMovie()
    this._dataProvider = new Array ();
    this._count = 0;
    this._depth = 1;
    this._isLoaded = -1;
    if (this._S_) {
    clearInterval (this._S_);
    }
    if (this._xmlfile != "") {
    this.loadXML (this._xmlfile);
    }
    };
    // *** load the external xml ** //
    ImageFader.prototype.loadXML = function (x) {
    var _xml = new XML ();
    _xml.ignoreWhite = true;
    _xml.path = this;
    _xml.load (x);
    _xml.onLoad = function () {
    for (var a = 0; a < this.firstChild.childNodes.length; a++) {
    var _trans = this.firstChild.childNodes[a].attributes.TRANSITION;
    var _pause = this.firstChild.attributes.PAUSE
    var _img = this.firstChild.childNodes[a].firstChild.nodeValue;
    this.path._dataProvider.push ({img:_img, transition:_trans, pause:_pause});
    }
    this.path.startFading ();
    delete this;
    };
    };
    // ** start fading procedure ** //
    ImageFader.prototype.startFading = function () {
    if (this._dataProvider.length > 0) {
    this.makeFader(true)
    }
    };
    // ** load images ** //
    ImageFader.prototype.makeFader = function (first) {
    this._isLoaded = -1;
    this._tmp = this.attachMovie ("ImageLoader", "ImageLoader" + this._depth, this._depth++);
    this._old1 = this['ImageLoader' + (this._depth - 1)]
    this._old2 = this['ImageLoader' + (this._depth - 2)]
    this._tmp.loadHandler ("isLoaded", this._count);
    this._tmp.autoStart = false;
    this._tmp.transition = this._dataProvider[this._count].transition
    this._tmp.loadImage (this._dataProvider[this._count].img);
    this._t1 = getTimer()
    this.onEnterFrame = function(){
    this._t2 = getTimer()
    if((this._t2 - this._t1) > this._dataProvider[this._count].pause || first==true){
    if(this._isLoaded == this._count || this._isLoaded == 1 && this._count == 0){
    delete this.onEnterFrame;
    this._tmp.start()
    this._old1.fadeOut()
    this._old2.removeMovieClip()
    if(this._count + 1 < this._dataProvider.length){
    this._count++
    this.makeFader()
    return;
    } else {
    if(this._loop == true){
    this._count = 0
    this.makeFader()
    }
    }
    }
    }
    }
    };
    // ** which has been loaded ? ** //
    ImageFader.prototype.isLoaded = function (num) {
    this._isLoaded = num;
    };
    Object.registerClass ("ImageFader", ImageFader);
    #endinitclip
    -------------------------------------------------------------------
    se io nel mio xml voglio aggiungerci:
    -------------------------------------------------------------------
    <?xml version="1.0"?>
    <RSS PAUSE="10000" LINK="pagina.html" >
    <IMAGE TRANSITION="7">images/1.jpg</IMAGE>
    <IMAGE TRANSITION="7">images/2.jpg</IMAGE>
    <IMAGE TRANSITION="7">images/3.jpg</IMAGE>
    </RSS>
    -------------------------------------------------------------------
    cosa devo aggiungere nello script??
    Se la mattina ti svegli con 4 palle il nemico è alle spalle!!

  2. #2
    Utente di HTML.it L'avatar di negatyve
    Registrato dal
    Feb 2001
    Messaggi
    9,479
    Aggiungere nell'xml via actionscript?

    codice:
    var data_xml = new XML();
    data_xml.ignoreWhite = true;
    data_xml.onLoad = function(success)
    {
    	if(success){
    		trace(this);
    		this.firstChild.attributes.LINK = "pagina.html";
    		trace("*************")
    		trace(this)
    	} else {
    		trace("XML FILE MISSING");
    	}
    };
    data_xml.load("file.xml");

  3. #3
    Ciao Negatyve,

    sono d'accordo con la tua idea, il problema è che siccome il nome della pagina cambierà spesso non vorrei ogni volta aprire il mio flash...capisci!!!

    Io ho provato così:
    ----------------------------------------------------------------
    var _trans = this.firstChild.childNodes[a].attributes.TRANSITION;
    var _pause = this.firstChild.attributes.PAUSE
    var _link = this.firstChild.attributes.LINK
    var _img = this.firstChild.childNodes[a].firstChild.nodeValue;
    this.path._dataProvider.push ({img:_img, transition:_trans, pause:_pause, link:_link});
    ----------------------------------------------------------------
    poi ho messo un pulsante dentro il mio flash e gli ho assegnato:
    ----------------------------------------------------------------
    on (release){
    getURL(link, "_self")
    }
    ----------------------------------------------------------------
    ma niente!!!

    Sai dirmi di +???

    Se la mattina ti svegli con 4 palle il nemico è alle spalle!!

  4. #4
    Utente di HTML.it L'avatar di negatyve
    Registrato dal
    Feb 2001
    Messaggi
    9,479
    ok, adesso ho capito. Dove sta il pulsante rispetto al movieclip nel quale hai messo quello script?

  5. #5
    sono distanti di un livello quindi credo potresti usare _parent ,comunque il pulsante stà nella _root e lo script stà dentro mc con istanza _fader

    il mc stà nella _root
    Se la mattina ti svegli con 4 palle il nemico è alle spalle!!

  6. #6
    Utente di HTML.it L'avatar di negatyve
    Registrato dal
    Feb 2001
    Messaggi
    9,479
    codice:
    _xml.onLoad = function()
    {
    	_root.link = this.firstChild.attributes.LINK;
    	for (var a = 0; a<this.firstChild.childNodes.length; a++) {
    		var _trans = this.firstChild.childNodes[a].attributes.TRANSITION;
    		var _pause = this.firstChild.attributes.PAUSE;
    		var _img = this.firstChild.childNodes[a].firstChild.nodeValue;
    		this.path._dataProvider.push({img:_img, transition:_trans, pause:_pause});
    	}
    	this.path.startFading();
    	delete this;
    };
    Il link è uno solo, quindi sta fuori dal ciclo for..

  7. #7
    Tu sei grande e io sono un cretino...!!

    Un'ultima cosa, se io volessi mettere nell'xml:
    ---------------------------------------------------------------
    <?xml version="1.0"?>
    <RSS PAUSE="10000" LINK="pagina.html|_blank ">
    <IMAGE TRANSITION="7">images/1.jpg</IMAGE>
    <IMAGE TRANSITION="7">images/2.jpg</IMAGE>
    <IMAGE TRANSITION="7">images/3.jpg</IMAGE>
    </RSS>
    --------------------------------------------------------------
    nel flash cosa dovrei modificare???
    Se la mattina ti svegli con 4 palle il nemico è alle spalle!!

  8. #8
    Utente di HTML.it L'avatar di negatyve
    Registrato dal
    Feb 2001
    Messaggi
    9,479
    codice:
    _xml.onLoad = function()
    {
    	var tempPath = this.firstChild.attributes.LINK.split("|");
    	_root.link = tempPath[0];
    	_root.targ = tempPath[1];
    	for (var a = 0; a<this.firstChild.childNodes.length; a++) {
    		var _trans = this.firstChild.childNodes[a].attributes.TRANSITION;
    		var _pause = this.firstChild.attributes.PAUSE;
    		var _img = this.firstChild.childNodes[a].firstChild.nodeValue;
    		this.path._dataProvider.push({img:_img, transition:_trans, pause:_pause});
    	}
    	this.path.startFading();
    	delete this;
    };
    e nel pulsante:

    codice:
    on (release){
    	getURL(link, targ);
    }

  9. #9
    sei davvero grande!!!

    grazie di tutto buona giornata.
    Se la mattina ti svegli con 4 palle il nemico è alle spalle!!

  10. #10
    Utente di HTML.it L'avatar di negatyve
    Registrato dal
    Feb 2001
    Messaggi
    9,479
    Di niente, ciao!

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.