• User Newbie

    scroll di thumb

    salve gente, sono nuovo e spero possiate darmi una mano. Ho fatto un giro ma non ho trovato nulla in mio aiuto. Ho una galleria di immagini con relative thumb che vengono caricate da file xml. Vorrei far scorrere le thumb come in questo sito ma non riesco a farlo.
    C'è un limite al numero delle foto inserite sempre riguardo allo scorrimento?
    Vi posto anche il codice della gallery a 2 pulsanti fashion01 fashion02 così si capisce meglio..

    
    fashion01_arr = new Array();
    fashion02_arr = new Array();
    btnRef_arr = new Array();
    my_xml = new XML();
    my_xml.ignoreWhite = true;
    my_xml.onLoad = function(success) {
        if (success) {
            searchXML();
        } else {
            trace("xml not loaded");
        }
    };
    my_xml.load("images.xml");
    function searchXML() {
        var allxml = my_xml.firstChild.firstChild;
        do {
            var arr = _root[allxml.nodeName+"_arr"];
            var ch = allxml.firstChild;
            do {
                arr.push(ch.childNodes);
            } while (ch=ch.nextSibling);
        } while (allxml=allxml.nextSibling);
    }
    fash01_btn.onRelease = function() {
        thumbRemover();
        holder_mc.SequentailImages(fashion01_arr);
    };
    fash02_btn.onRelease = function() {
        thumbRemover();
        holder_mc.SequentailImages(fashion02_arr);
    };
    MovieClip.prototype.SequentailImages = function(images) {
        this.curImage = 0;
        this.images = images;
        this.ImageFromSequence();
        this.onEnterFrame = function() {
            var clipLoaded = this.imageClip.getBytesLoaded();
            var clipTotal = this.imageClip.getBytesTotal();
            var percent = clipLoaded/clipTotal;
            if (percent == 1) {
                this.imageClip.onRollOver = function() {
                    this._alpha = 100;
                };
                this.imageClip.onRollOut = this.imageClip.onDragOut=function () {
                    this._alpha = 50;
                };
                this.imageClip.onRelease = function() {
                    image_mc.loadMovie(this.id.images[this.idx]+".jpg");
                };
                this.imageClip.id = this;
                this.imageClip.idx = this.curImage;
                this.curImage++;
                if (this.curImage>=this.images.length) {
                    this.onEnterFrame = undefined;
                    imageGen(images);
                } else {
                    this.ImageFromSequence();
                }
            }
        };
    };
    MovieClip.prototype.ImageFromSequence = function() {
        this.imageClip = this.createEmptyMovieClip("thumb"+this.curImage+"_mc", this.curImage);
        this.imageClip.loadMovie(this.images[this.curImage]+"_th.jpg");
        this.imageClip._x = 65*this.curImage;
        this.imageClip._alpha = 50;
        btnRef_arr.push(this.imageClip);
    };
    function thumbRemover() {
        for (var n = 0; n<btnRef_arr.length; n++) {
            btnRef_arr.removeMovieClip();
        }
    }
    MovieClip.prototype.alpha = function(vel, to) {
        this.vel = vel;
        this.to = to;
        this.alpha_init = this._alpha;
        this.onEnterFrame = function() {
            updateAfterEvent();
            if (this.to != undefined && this.vel != undefined) {
                if (this.to>this.alpha_init) {
                    if (this._alpha<=100) {
                        this._alpha += this.vel;
                    } else {
                        this.onEnterFrame = null;
                    }
                } else {
                    if (this._alpha>this.to) {
                        this._alpha -= this.vel;
                    } else {
                        this.onEnterFrame = null;
                    }
                }
            }
        };
    };
    var randomNum, randomNumLast, xpos, ypos = 0;
    _global.numPause = 4000;
    _global.fadetime = 2;
    image_mc.createEmptyMovieClip("loader1_mc", 2);
    image_mc.createEmptyMovieClip("loader2_mc", 1);
    this.createEmptyMovieClip("watcher_mc", 100);
    function swapPlace(clip, num) {
        eval(clip).swapDepths(eval("image_mc.loader"+num+"_mc"));
    }
    function loadImages(data, num) {
        if (i == undefined || i == 2) {
            i = 2;
            createLoader(i, data, num);
            i = 1;
        } else if (i == 1) {
            createLoader(i, data, num);
            i = 2;
        }
    }
    function createLoader(i, data, num) {
        thisLoader = eval("image_mc.loader"+i+"_mc");
        thisLoader._alpha = 0;
        thisLoader.loadMovie(data[num]+".jpg");
        watcher_mc.onEnterFrame = function() {
            var picLoaded = thisLoader.getBytesLoaded();
            var picBytes = thisLoader.getBytesTotal();
            if (isNaN(picBytes) || picBytes<4) {
                return;
            }
            if (picLoaded/picBytes>=1) {
                swapPlace("image_mc.loader2_mc", 1);
                thisLoader.alpha(_global.fadeTime, 100);
                timerInterval = setInterval(imageGen, _global.numPause, data);
                delete this.onEnterFrame;
            }
        };
    }
    function imageGen(data) {
        if (p == undefined || p == data.length) {
            p = 0;
        }
        loadImages(data, p);
        p++;
        clearInterval(timerInterval);
    }
    
    ``` Grazie milleeee!!

  • Super User

    Buonasera spiro,

    se puo essere d'aiuto [url=http://www.kirupa.com/developer/mx2004/thumbnails.htm]ecco un tutorial

    🙂


  • User Newbie

    Grazie Onsitus..ho provato ma non riesco a far interagire la funzione di scroll con il mio codice..cioè se inserisco o non fa nulla..o non compaiono più le foto..o ne compare solo una..hmmm..