-
phoenix1 #1419 A CS3-ról csak álmodozni fogok, de amit álmodoztam ... vagyis láttam belőle nagyon igéretes, sok mindent meglehet CS3 csinálni.
Éppen most foglalkoztam én is ezzel a témával és ... röviden erre jutottam:
.fla
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
description2 = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
description2[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
}
// end of for
firstImage();
} else {
_root.prev_btn.enabled = false;
_root.next_btn.enabled = false;
_root.output._visible = true;
setTD("Fájl nem található!", "Kérjük ellenőrizze, hogy helyessen-e adta meg a fájl elérési útvonalát. Majd próbálja meg újból.");
}
// end else if
}
// End of the function
// Get file type
function getType(file) {
dot_pos = file.indexOf(".", 0)+1;
ext = file.substr(dot_pos, file.length);
return ext;
}
// End of the function
function fadeIn() {
onEnterFrame = function () {
filesize = top.getBytesTotal();
loaded = top.getBytesLoaded();
percent_done = int((loaded/filesize)*100);
if (loaded<filesize) {
_root.preloader._visible = true;
_root.preloader.done.text = percent_done.toString();
} else {
_root.preloader._visible = false;
var ext = getType(image[p]);
if (ext !== "swf") {
_root.symbols._visible = true;
} else {
_root.symbols._visible = false;
}
if (top._alpha<100) {
top._alpha = top._alpha+3;
} else {
delete onEnterFrame;
slideshow();
}
// end else if
}
// end else if
};
}
// End of the function
function fadeOut() {
onEnterFrame = function () {
if (top._alpha>5) {
top._alpha = top._alpha-5;
} else {
top._alpha = 0;
delete onEnterFrame;
nextImage();
}
// end else if
};
}
// End of the function
function nextImage() {
if (p<total-1) {
++p;
top._alpha = 0;
top.loadMovie(image[p]);
setTD(description[p], description2[p]);
picture_num();
fadeIn();
} else {
p = 0;
top._alpha = 0;
top.loadMovie(image[p]);
setTD(description[p], description2[p]);
picture_num();
fadeIn();
}
// end else if
}
// End of the function
function prevImage() {
if (p>0) {
--p;
top._alpha = 0;
top.loadMovie(image[p]);
setTD(description[p], description2[p]);
picture_num();
fadeIn();
} else {
p = total-1;
top._alpha = 0;
top.loadMovie(image[p]);
setTD(description[p], description2[p]);
picture_num();
fadeIn();
}
// end else if
}
// End of the function
function firstImage() {
init = true;
top._alpha = 0;
top.loadMovie(image[0]);
setTD(description[p], description2[p]);
picture_num();
fadeIn();
}
// End of the function
function picture_num() {
current_pos = p+1;
pos_txt.text = current_pos+" / "+total;
}
// End of the function
function slideshow() {
function pause_slideshow() {
clearInterval(myInterval);
showTD(false);
if (p == total-1 && !init) {
p = 0;
firstImage();
} else if (p == total-1 && init) {
p = -1;
swap("fwd");
} else {
swap("fwd");
}
// end else if
}
// End of the function
showTD(true);
var ext = getType(image[p]);
if (ext !== "swf") {
_root.symbols._visible = true;
myInterval = setInterval(pause_slideshow, delay);
} else {
_root.symbols._visible = false;
}
}
// End of the function
function swap(dir) {
var _loc1 = top;
top.swapDepths(bot);
top = bot;
bot = _loc1;
if (dir == "fwd") {
nextImage();
} else {
prevImage();
}
// end else if
}
// End of the function
var delay = 10000;
var init = false;
var top = picture4;
var bot = picture3;
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load(_root.xml_data);
//'general.xml'
p = 0;
function setTD(stitle, sdesc) {
_root.output.title_txt.text = stitle;
_root.output.desc_txt.text = sdesc;
}
function showTD(bvisible) {
if ((description[p] == undefined) && (description2[p] == undefined)) {
modify = false;
} else {
modify = bvisible;
}
_root.prev_btn.enabled = bvisible;
_root.next_btn.enabled = bvisible;
_root.output._visible = modify;
}
function next_file() {
clearInterval(myInterval);
showTD(false);
swap("fwd");
}
Key.addListener(listen);
next_btn.onRelease = function() {
clearInterval(myInterval);
showTD(false);
swap("fwd");
};
Key.addListener(listen);
prev_btn.onRelease = function() {
clearInterval(myInterval);
showTD(false);
swap("rev");
};
.xml
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<root>
<slide>
<image>/kepek/elso.jpg</image>
<title></title>
<desc></desc>
</slide>
<slide>
...
</slide>
</root>