problema con gallery flash8
-
ciao a tutti
ho un problema che potrebbe essere semplice ma mi sta complicando non poco la vita.
allora ho creato un gallery in flash con un tutorial che mi carica le anteprime e leimmagine da un file xml.
ora quando clicco sulle anteprime si aprono le immagini ma io vorrei che le mie immagini si aprino scorrendo da destra a sinistra fermandosi per essere visualizzate.
Ho visto che in as2 c'e un comando che e' il seguente:import mx.transitions.;
import mx.transitions.easing.;
TransitionManager.start(img1_mc, {type:Fly, direction:Transitionma non riesco ad inserirlo nel punto giusto
il codice del mio filmato invecee' il seguente
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
thumbnails = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image = xmlNode.childNodes.childNodes[0].firstChild.nodeValue;**
description = xmlNode.childNodes.childNodes[1].firstChild.nodeValue;**
thumbnails = xmlNode.childNodes.childNodes[2].firstChild.nodeValue;**
thumbnails_fn(i);
}
firstImage();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images.xml");
/////////////////////////////////////
listen = new Object();
listen.onKeyDown = function() {
if (Key.getCode() == Key.UP) {
prevImage();
} else if (Key.getCode() == Key.DOWN) {
nextImage();
}
};
Key.addListener(listen);
previous_btn.onRelease = function() {
prevImage();
};
next_btn.onRelease = function() {
nextImage();
};
/////////////////////////////////////
p = 0;
this.onEnterFrame = function() {
filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();
preloader._visible = true;
if (loaded != filesize) {
preloader.preload_bar._xscale = 100loaded/filesize;*
} else {
preloader._visible = false;
if (picture._alpha<100) {
picture._alpha += 10;
}
}
};
function nextImage() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();
}
}
}
function prevImage() {
if (p>0) {
p--;
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();
}
}
function firstImage() {
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[0], 1);
desc_txt.text = description[0];
picture_num();
}
}
function picture_num() {
current_pos = p+1;
pos_txt.text = current_pos+" / "+total;
}
function thumbNailScroller() {
// thumbnail code!
this.createEmptyMovieClip("tscroller", 1000);
scroll_speed = 10;
tscroller.onEnterFrame = function() {
if ((_root._xmouse>=thumbnail_mc._x) && (_root._xmouse<=thumbnail_mc._x+thumbnail_mc._width)) {
if ((_root._ymouse>=(hit_right._y-40)) && (thumbnail_mc.hitTest(hit_right))) {
thumbnail_mc._y -= scroll_speed;
} else if ((_root._ymouse<=(hit_left._y+40)) && (thumbnail_mc.hitTest(hit_left))) {
thumbnail_mc._y += scroll_speed;
}
} else {
delete tscroller.onEnterFrame;
}
};
}function thumbnails_fn(k) {
thumbnail_mc.createEmptyMovieClip("t"+k, thumbnail_mc.getNextHighestDepth());
tlistener = new Object();
tlistener.onLoadInit = function(target_mc) {
*target_mc._y =(target_mc._height+5)k;
//trace(target_mc._width+" "+target_mc._parent._rotation)
target_mc.pictureValue = k;
target_mc.onRelease = function() {
p = this.pictureValue-1;
nextImage();
};
target_mc.onRollOver = function() {
this._alpha = 50;
thumbNailScroller();
};
target_mc.onRollOut = function() {
this._alpha = 100;
};
};
image_mcl = new MovieClipLoader();
image_mcl.addListener(tlistener);
image_mcl.loadClip(thumbnails[k], "thumbnail_mc.t"+k);
}grazie
ciao -
ciao rogerB,
prova così:
metti
[code]
import mx.transitions.;
import mx.transitions.easing.;nelle prime 2 righe così importi la classe transitions.
Poi tutto ciò che vuoi fare con TransitionManager è :
dove hai il metodo onLoadInit()
tlistener.onLoadInit = function(target_mc) {
quì metti il codice di TransitionManager ricordandoti che vuole diversi parametri di cui il primo è il nome della movieclip a cui vuoi applicare l'effetto transitions e quindi sarà quella che contiene l'immagine caricata.
Gli altri parametri li devi sciegliere tu in base all'effetto.
Per sapere che parametri devi mettere in base all'effetto che vuoi devi per forza dare un'occhiata e studiarti questo: -
-
-
-
-
-
-
cerca di capirmi...se dovessi controllare i .fla di tutti gli utenti che postano sul forum non avrei neanche più tempo di lavorare. (purtroppo il mio tempo è molto limitato).
Gli ho dato un'occhiata veloce e la movieclip su cui devi lavorare si chiama picture.
Nelle funzioni firstImage(), nextImage() e prevImage() devi creare un effetto a picture che è la movieclip che ti carica le foto.

-
Ciao! Sembra che tu sia interessato a questa conversazione, ma non hai ancora un account.
Stanco di dover scorrere gli stessi post a ogni visita? Quando registri un account, tornerai sempre esattamente dove eri rimasto e potrai scegliere di essere avvisato delle nuove risposte (tramite email o notifica push). Potrai anche salvare segnalibri e votare i post per mostrare il tuo apprezzamento agli altri membri della comunità.
Con il tuo contributo, questo post potrebbe essere ancora migliore 💗
Registrati Accedi