Hi, all,
I’m reposting this message as I realized I mis-titled it the first time. And I really do mean it: I will pay for a working solution to this problem. I need to do this for a client and not getting it done is not an option.
I’m using Flash CS3 and have built a slide show using the excellent XML Photo Gallery tutorial, as well as adding sound thanks to another post in this forum. It’s all working like a charm. The only bad thing is: I want to place .swfs files where the dynamic text is right now, and can’t figure out how to do it.
What I really want is one large image/JPG on each slide, and below that, instead of the dynamic text shown in the tutorial example, a smaller .swf file should appear. (For this project, the text itself needs to be animated, and I can’t do that with the <caption>/dynamic text option; I need to insert an SWF.) I’d really like to do this using XML since that’s working so nicely otherwise and will be so easy to update in the future if the client wants to add new slides.
Can anyone provide me with the actionscript code to use in the context of this photo gallery? I’m not advanced enough yet to know where or how to place code that doesn’t fall into this gallery/AS format.
(I’m not being lazy: I have looked all over these forums for hours, read through about 60 pages of tutorials, went through the whole XML Photo Gallery with Thumbnails hoping I could somehow alter that to meet this project’s needs… no dice. I had gotten far enough in that tutorial to be able to insert an empty movie clip where I want it, but could only figure out how to fill it with JPGs from the XML, not SWFs… and in any case the images did not then work correctly while advancing the slides.)
Here is my current Actionscript code:
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
audio = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
description* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
audio* = xmlNode.childNodes*.childNodes[2].firstChild.nodeValue;
}
firstImage();
} else {
content = “file not loaded!”;
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load(“infant_images.xml”);
/////////////////////////////////////
listen = new Object();
listen.onKeyDown = function() {
if (Key.getCode() == Key.LEFT) {
prevImage();
} else if (Key.getCode() == Key.SPACE) {
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 = false;
if (loaded != filesize) {
preloader.preload_bar._xscale = 100*loaded/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];
sound = new Sound();
sound.loadSound(audio[p],true)
}
}
}
function prevImage() {
if (p>0) {
p–;
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
sound = new Sound();
sound.loadSound(audio[p],true);
}
}
function firstImage() {
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[0], 1);
desc_txt.text = description[0];
sound = new Sound();
sound.loadSound(audio[0],true)
}
}
function loadSound() {
if (loaded == filesize) {
createEmptyMovieClip(“sound_mc”,2);
sound_mc.sound_obj = new Sound();
sound_mc.sound_obj.loadSound( sound[p], true);
sound_mc.sound_obj.play();
}
}
(It’s not showing the preloader and the counter is missing on purpose; I don’t need those items for this project…) In another version I have deleted the desc_txt code and the dynamic text field in Flash, substituting a new movie clip (in its own layer) called “description” and an external link to the SWF file in line 2 of each node of my XML file, closing and opening that line with <description> and </description> rather than <caption>.
Thank you for any help you can give! (Kirupa? Stringy? Anyone?) And please let me know how I can pay you: through PayPal, with a check, or what.