ciao a tutti..
ho una slideshow che carica le immagini da file xml.Il funzionamento è circa questo:creo i pulsanti (in questo caso 2:fashion1 fashion2) clikko su un pulsante mi appaiono le thumb, clikko su una thumb e mi apre l'immagine ingrandita.Quello che vorrei fare è aggiungere il codice per far scorrere le thumb in orizzontale a seconda della posizione del mouse. Qualcuno mi potrebbe aiutare?grazie mille in anticipo.
Vi posto il codice:
codice: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[n].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); }

Rispondi quotando