View Full Version : XML Slideshow/PhotoGallery - Hyperlinking Each Image
kirupa
01-05-2005, 12:19 AM
Hey everyone,
After a member request, here is a minor modification to the code for the photo gallery and slideshow tutorials. I modified the code from both the tutorials to take into account URL data from the XML file. When somebody clicks on the image, a new web page with the URL will be displayed. I guess that is great for people wanting to show a gigantic version of the image when somebody clicks on it :)
I have attached the photo gallery zip file and the slideshow zip file below. The XML file, HTML, and SWF files are inside the zip file.
Cheers!
Kirupa :ninja:
FlashPlaya
01-06-2005, 02:12 PM
WOW!! THANKS K MAN!!!!!!
I was trying to figure that out forever....:thumb:!!!!
suspire
02-21-2005, 02:16 AM
indeed thanks man.
now i've just got to figure out how to make the text linkable as well.
dream
08-10-2005, 05:13 PM
please help.
how do you make the text to link too
darylmeter
08-14-2005, 06:41 PM
please help.
how do you make the text to link too
Make a movie clip to go under your text. in my case i called the instance "textlink"
Then within you code add this under the picturelink code.
textlink.onRelease = function() {
getURL(link[p]);
};
darylmeter
08-14-2005, 06:46 PM
Now - I was looking for some help to make the first image RANDOM.
Does anyone have any clues?
Ive tried to chnge this
p = 0;
to this
p = Math.floor(Math.random() * total);
But its not making it random.
Cheers
darylmeter
08-15-2005, 12:59 AM
also if there's a way to fade the image out, in the same way it fades in. Any help greatly appreciated.
Cheers
dream
08-15-2005, 02:32 AM
thanks darylmeter.
tamagorci
08-18-2005, 05:48 AM
hi!
i'm also very interested in fading the images out and
changing the method from alpha to brightness, somehow
i can't get it
:puzzled:thanks!
darylmeter
08-22-2005, 07:37 PM
Well I worked it out using some of these other helpful threads.
here is my code:
The important changes are from the function slideshow() down, and including this
this.fadeOutSpeed = 2;
var fadOutInt:Number;
///////////////////////////////////////////////////////////////////////////
delay = 6000;
this.fadeSpeed = 10;
this.fadeOutSpeed = 2;
var fadOutInt:Number;
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
//
//define link variable
//
link = [];
blank = [];
//
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;
//
//adding links
//
link[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
blank[i] = xmlNode.childNodes[i].childNodes[3].firstChild.nodeValue;
//
eval(i).onRollOut = function() {
a = 0;
b = 0;
cap._visible = false;
this.onEnterFrame = function() {
this.masked._alpha *= 1.1;
if (this.masked._alpha>=100) {
this.masked._alpha = 100;
a = 1;
}
if (a == 1) {
delete this.onEnterFrame;
}
};
};
}
firstImage();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("image_and_link2.xml?task=refresh");
/////////////////////////////////////
listen = new Object();
listen.onKeyDown = function() {
if (Key.getCode() == Key.LEFT) {
prevImage();
} else if (Key.getCode() == Key.RIGHT) {
nextImage();
}
};
//p = 0;
p = Math.floor(Math.random() * 4);
_root.tell == p;
this.onEnterFrame = function() {
filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();
preloader._visible = true;
if (loaded != filesize) {
preloader.preload_bar._xscale = 100*loaded/filesize;
} else {
preloader._visible = false;
if (picture._alpha<100) {
picture._alpha += 3;
}
}
picture.onRelease = function() {
getURL(link[p], "_"+blank[p]);
};
picture.onRollOver = function() {
_root.tool_tip.startDrag(true);
_root.tool_tip.title = "click for more from "+ description[p];
//_root.tool_tip.title = blank[p];
_root.tool_tip._visible = true;
};
picture.onRollOut = function() {
stopDrag ();
_root.tool_tip._visible = false;
};
textlink.onRelease = function() {
getURL(link[p]);
textlink._alpha += 5;
};
};
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();
slideshow();
}
}
}
function firstImage() {
if (loaded == filesize) {
picture._alpha = 0;
// picture.loadMovie(image[0], 1);
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();
slideshow();
}
}
function picture_num() {
current_pos = p+1;
pos_txt.text = current_pos+" / "+total;
}
function slideshow() {
myInterval = setInterval(pause_slideshow, delay);
function pause_slideshow() {
clearInterval(myInterval);
if (p == (total-1)) {
p = 0;
firstImage();
} else {
fadeOut();
}
}
function fadeOut() {
clearInterval(pauseInterval);
fadeOutInt = setInterval(fadeOutImg, fadeOutSpeed);
}
}
function fadeOutImg(){
if(picture._alpha < fadeOutSpeed){
clearInterval(fadeOutInt);
picture._alpha = 0;
loadNextImg();
}
else{
picture._alpha -= fadeOutSpeed;
updateAfterEvent(); // refresh according to setInt delay, not framerate
}
};
function loadNextImg() {
if (p == (total-1)) {
p = 0;
firstImage();
} else {
nextImage();
}
};
///////////////////////////////////////////////////////////////////////////
kirupa
08-23-2005, 12:51 AM
Using the [as] tags maybe helpful for displaying a lot of actionscript code :)
gheuntak
08-23-2005, 09:19 AM
Is there any possibility to add Transition effects to these images? If yes how would I add it? Any help will be appreciable.
Thanks
darylmeter
08-23-2005, 11:26 PM
I found link link that has examples for xml transitions.
might help
http://blog.reintroducing.com/index.php/27/07/2005/42
ps sorry bout long as code from above
I have read and applied the tutorial named Photo Slideshow Using XML and Flash, but I had needed the slideshow function too. So I started to search topics about this tutorial and I found out this topic. I have downloaded 2 flas. One of them does the next and previous function and other one does the slideshow function. I need those 2 functions together :)
I have also added a play button and try to achieve what I want with putting the codes together from those 2 fla's. I have just copied these codes from pg_hyperlink's fla into the slideshow_link's fla
previous_btn.onRelease = function() {
prevImage();
};
next_btn.onRelease = function() {
nextImage();
};
play_btn.onRelease = function() {
slideshow();
};
Next Function works and Previous Function works but slideshow function does not works right.It gos crazy showing some images and not showing some of them.
So can u guys help me to achieve this? Also I am posting the fla I have changed.
liquify
09-26-2005, 04:33 PM
Hi all,
Im using the kirupa's xml photo gallery.
When i click the photo i get a link, using:
picture.onRelease = function() {
getURL(link[p], "_blank");
};
My question is.. some of my photos dont have a link but the photo remains "clickable" and it opens an error page.
Can i change this?
Thank you so much!
cheesie3
10-04-2005, 09:05 AM
hi
how can i add html formatting to the 'description' text'?
thanks
cheesie
cheesie3
10-05-2005, 06:32 PM
is this such a goofy Q?
suspire
10-06-2005, 01:16 PM
I've seen html formatting in xml called text before but don't remember where the code is or if it would work here. Did you want to have the description like a paragraph with multiple links?
cheesie3
10-06-2005, 01:41 PM
...Did you want to have the description like a paragraph with multiple links?
that was the idea and also to add the odd line break too, plus the odd bolded word or 2 too.
cheers
cheesie
suspire
10-06-2005, 02:48 PM
Good idea. I also need it to load a second image.
Anybody up for it?
EXACTLY what I'm looking for, thanks Kirupa! :) Only problem is I can't open the .fla in your zip file
"Unexpected file format" (I'm using MX, so maybe a lower version.) Can you (or someone) post/email the AS for the slideshow so I can use links?
Thanks a lot,
JC
visual2005
10-12-2005, 10:01 PM
is it too late for me to inform kirupa, the xml photo viewer tutorial!!, good stuff!, i was looking for somehting like that, but yours i like the fade in/out effect, and image loader (damm i diditn know u can have a loader for external for image) good stuff!
just one thing to ask... reagrds to how flash handles images,, the images u used in the example work! well no problem but images i created (i used paint shop pro, saved as jpg) apprantly cant load !..... i was puzzled.. so end up i exported the same images in adobe photoshop and then the image loads in flash..
funny problem, i know it has nothing to do with your codes, ur codes works well...just wondering if anyone had such similar experiences?...
kirupa
10-12-2005, 11:33 PM
If you save the image as a progressive JPEG, Flash won't be able to read it :rambo:
visual2005
10-12-2005, 11:35 PM
If you save the image as a progressive JPEG, Flash won't be able to read it :rambo:
progressive jpeg huh.. THANKS a million man...
:)
ezalexander
10-31-2005, 02:47 PM
Does this work with javascript? I would like to have control over the new window I am opening.....would the JS go in the xml file??
Alex
Great...this is what I was looking for! but for some reason .fla would not open. It gives me "Unexpected File Format" error. I am using Flash MX ver 6.
Can anybody help me please.
Thanks
andrew777
11-17-2005, 06:56 PM
Love the tutorial, but when I try to open the FLA file in MX it doesn't open and says "Unexpected File Format".
I'm trying to open the flash file:
xml_photogallery_user_mx.zip
Any help would be greatly appreciated!
Thanks.
kirupa
11-17-2005, 07:03 PM
Love the tutorial, but when I try to open the FLA file in MX it doesn't open and says "Unexpected File Format".
I'm trying to open the flash file:
xml_photogallery_user_mx.zip
Any help would be greatly appreciated!
Thanks.
Andrew - I have received that message intermittently from users in the past, and I don't know what is causing this problem. Are you running Flash MX on a Mac?
rhamej
11-18-2005, 12:17 AM
Hi all,
Im using the kirupa's xml photo gallery.
When i click the photo i get a link, using:
picture.onRelease = function() {
getURL(link[p], "_blank");
};
My question is.. some of my photos dont have a link but the photo remains "clickable" and it opens an error page.
Can i change this?
Thank you so much!
Kinda a late reply, but you could use:
picture.onRelease = function() {
if(link[p]!=null){
getURL(link[p], "_blank");
}
};
Just leaving the node empty will give you a null value I think.
Just in case any one is wondering :)
andrew777
11-18-2005, 03:26 AM
Hi Kirupa,
No, I'm using Flash MX on a PC....
When I unzip the folder the files look fine by looking at the icons, but it just doesn't want to open....
Don't know what to do, but the tutorial you posted about the photogalleries are exactly what I was looking for, just wish I could use it :-(
I guess I'll keep checking back to see if anyone comes up with an answer...
Thanks for the quick response though..
Andrew - I have received that message intermittently from users in the past, and I don't know what is causing this problem. Are you running Flash MX on a Mac?
Hi, i have the same problem.. maybe someone could post here modified code for slideshow.. as i see many people can't open the file so it's not just about me. I'd be glad if someone could paste original code here.
Tif_Ann
12-20-2005, 12:06 AM
This is wonderful and exactly what I've been working on. Now to see if I can make it open in a popup window that I define. I'd love to make it be dynamic as well ... the image with a specific beginning (like lg_image) for example.
jp182
12-23-2005, 09:19 PM
Make a movie clip to go under your text. in my case i called the instance "textlink"
Then within you code add this under the picturelink code.
textlink.onRelease = function() {
getURL(link[p]);
};
i tried this but it didnt work. any suggestions?
electricfan
01-19-2006, 12:07 PM
Hi Everyone..
Love that the link piece works on the image. Now for my project I would like to caption become a link?
Can it be done??
Electricfan..
jp182
01-19-2006, 04:22 PM
very good question
RevoGiant
01-19-2006, 11:03 PM
Hey there Kirupa. this is a realtively easy question I think. I am trying to apply a slower fade to the gallery with thumbnails and i cant seem to get it right with the AS that was published at the begging of this thread. Can anyone help me ease the alpha slower for the XML gallery with thumbnails? Thanks!
jonathanOber
01-26-2006, 12:38 PM
Hey all, I was just wondering if any of you know of how I can add alt tags to the large image? If anyone has an idea, hopefully within the xml let me know.
Thanks,
Jonathan
rhamej
01-26-2006, 01:50 PM
Hey all, I was just wondering if any of you know of how I can add alt tags to the large image? If anyone has an idea, hopefully within the xml let me know.
Thanks,
Jonathan http://www.kirupa.com/developer/mx2004/hover_captions.htm
jonathanOber
01-26-2006, 02:06 PM
http://www.kirupa.com/developer/mx2004/hover_captions.htm
I was hoping to have the captions be picture specific. THis doesnt really help with that need, as the captions are for movie clips or buttons and not graphics loaded in via xml.
http://server.webtekcc.com/~cabinets/ this the project, not completed yet. I want an alt tag to come up when you rollOver the large image and be specific to that picture, ie. xml
Thanks for your help!
rhamej
01-26-2006, 02:13 PM
The link I gave is exactly what you need. :sigh: You make your graphic a button/movieclip, then replace the hover captions content with your xml node.
At least try dude.
blind486
01-30-2006, 02:48 AM
kirupa thanks for the url link code!:whistle:
blind486
01-30-2006, 05:04 AM
I found link link that has examples for xml transitions.
might help
http://blog.reintroducing.com/index.php/27/07/2005/42
ps sorry bout long as code from above
:( its so hard to apply the code on the xml slideshow, the transition example is a movie inside a movie, he made a movie and mask it with the movie with that comes w/ xml. in xml slideshow, it just messes up :hair:. is there someone who can provide a much easier way for the xml slideshow to have a transition that can easily be customized.
maybe we can add the transition in this part... to remove the old
fade effect transistion
ActionScript Code:
else {
preloader._visible = false;
if (picture._alpha<100) {
picture._alpha += 10;
}
kguerrero
02-02-2006, 01:25 PM
The code provided here is fairly simple to understand and helpful. I have utilized code submitted by darylmeter in order to utlize fade out.
I would like the fade out of the image1 to occur simultaneously as the fade in with image2.
It seems to me that this is a weakness in the demonstrated AS. Currently, image 1 completely fades out before image 2 begins to fade in. Is this correct?
If not, what can be done since it is apparent when I run this that the images are displayed concurrently.
If it is correct is it because only one intance called "picture" is being used. If this is the case how can this be easily fixed?
Thanks,
ocalabrad
02-13-2006, 10:51 PM
The code provided here is fairly simple to understand and helpful. I have utilized code submitted by darylmeter in order to utlize fade out.
I would like the fade out of the image1 to occur simultaneously as the fade in with image2.
It seems to me that this is a weakness in the demonstrated AS. Currently, image 1 completely fades out before image 2 begins to fade in. Is this correct?
If not, what can be done since it is apparent when I run this that the images are displayed concurrently.
If it is correct is it because only one intance called "picture" is being used. If this is the case how can this be easily fixed?
Thanks,
I would like a solution to this as well.
booler
02-13-2006, 10:58 PM
I haven't looked at the code for this but I can say for certain its not a shortcoming of AS its just how its been coded.... theres no reason you can't set it up to fade one element out and the other in at the same time it may be a little processor intensive but it can work
Lakshmi M
02-23-2006, 02:19 PM
I am using the xml and flash slideshow in Mx. I want to combine the slideshow function with the next/previous function.
I have added the necessary buttons for next, previous and play and added the following to the code
previous_btn.onRelease = function() {
prevImage();
};
next_btn.onRelease = function() {
nextImage();
};
play_btn.onRelease = function() {
slideshow();
};
But I cant seem to get the play button to stop or rather switch from next/previous function to slideshow function and vice versa. A similar post talks of the same. But I have not been able to view the attached puttingtogether.zip as it seems to be a different version of flash. Can i get the combined code in mx or just the actionscript for the same?
thanks.
tonygarcia
02-24-2006, 12:09 AM
what needs to be modified to have these images cycle automatically?
Maxik
07-18-2006, 03:47 AM
all of this is great, but is there a way to make the larger image POP UP? I have tried several java scripts, but none of them work since it's XML and not .html
EDIT: Go Here if you are having the same question (http://www.kirupa.com/forum/showthread.php?t=227677)
Is there a way for an image that you pull in from XML to link, instead of to an external URL, to a particular "place" in the slideshow?
jp182
09-29-2006, 08:57 PM
i think thats possible but i think you have to modify the code to say go to a particular frame instead of getting the url of the image......its speculation though
superstring
10-10-2006, 06:32 PM
I'm working on a site that uses the kirupa flash xml photo gallery with thumbnails, and everything is working fine, but my client asked me a question that I have no idea how to solve. Basically they want each click, either on a thumbnail or the next and back buttons, to generate a page identifier in the url so their analytics software can generate new ads.
they said it should be some javascript like this:
reportClick("site|subsection|pagename slidenumber");
where "pagename slidenumber" is a unique page name identifier. So maybe
something like "Kitchen Slide 2" could be used, as an example.
So given this request, I have 2 questions:
1. Is this possible? I'm under the assumption that the flash movie is self-contained, and have no idea how to generate separate urls other than to make separate html files for each image, ie. not even make a flash site to begin with and make an html site instead. But I've already made a flash site because that's what they wanted, so that's not an option.
2. If it is possible, is that javascript correct, and where would I put it in my action script. I'm not much of a coder - I kind of fake it as I go along. I'm assuming there would have to be a listener put in that takes the info from the page number function and puts that in the url.
Can anyone help me on this?
scopa
10-11-2006, 08:16 PM
The code provided here is fairly simple to understand and helpful. I have utilized code submitted by darylmeter in order to utlize fade out.
I would like the fade out of the image1 to occur simultaneously as the fade in with image2.
It seems to me that this is a weakness in the demonstrated AS. Currently, image 1 completely fades out before image 2 begins to fade in. Is this correct?
If not, what can be done since it is apparent when I run this that the images are displayed concurrently.
If it is correct is it because only one intance called "picture" is being used. If this is the case how can this be easily fixed?
Thanks,
I also would like to know how to add a crossfade transition... seems like it should be possible. I just don't know how to do it.
reelmesh
10-28-2006, 05:25 PM
Hi everyone, I've been using these great tutorials to build an online catalog for a client, however instead of an external link I would like to load a SWF into a movieclip on the site's main SWF which I'm using to load all the components of the site.
I tried changing the getURL code to the following:
picture.onRelease = function() {
_root.zoom.loadMovie(link[p]);
};I also changed the content of the <link> tag to the name of the SWF file I wish to load (it is in the same directory as the rest of the files), also tried adding the "" on the XML but I still couldn't make it work, I wonder what I'm doing wrong, can someone help me please?
Thanks.
reelmesh
10-29-2006, 05:51 AM
Bump, Can some one help please?
reelmesh
10-29-2006, 09:48 AM
I've just tried to use the image node/array instead of the link one I was using and it worked to my purpose right away.
I assume it must be some problem with the way the link array is made and used in the code.
I'm a so lost on this, it seems to be perfect, I can't see the problem with the link array.
It's the same code as the original in this post except that is has some extra nodes/arrays to store some extra information.
Can some one shed some light on this subjet?
Thanks
nigelt74
11-07-2006, 06:53 PM
Does anyone have the full slideshow with the link bit incorporated?
I have a problem in that my Flash MX (version 6.0) is giving me the
"Unexpected File format"
error that a few others seem to be suffering,
(was there a solution? I am running win 2K, Flash MX 6.0 - if it helps)
I originally wanted to get this slide show and have clickable links (both the image and text) and alter the fade thing mentioned by darrelmeter and if possible attempt to add in some different transition effects like those mentioned in the given link, but as my flash doesn't like the file i can't, (actually it's a bit of a relief as my entire flash programming consisted of a stick man kicking a ball about 4 years ago - and haven't touched it since)
So if anyone has that version and could post it here it would be appreciated
or if someone knows what a solution to the "Unexpected File Format" error
audrius'05
11-08-2006, 09:11 PM
I wonder if there is a tiny AS code that can be added either in the AS or XML file that can clean internet cashed images. I 'd like to make a nice screensaver that will load images from the website and the thing is that if I update images my screensaver will still show old images. I'd like to automatically remove gallery's images after each image was viewed from Internet temp files.
audrius'05
12-06-2006, 05:07 AM
Is there a way to make pictures load randomly?
adamclark
12-30-2006, 09:43 PM
I think this is a great slideshow and the inclusion of links wonderful. However, when i click on my slideshow links, i am getting an "undefined" page, as if i did not specify links, which I did.
Can anyone help me with that?
nigelt74
12-30-2006, 10:30 PM
Adam it may pay to provide a link to your misbehaving slideshow, and a copy of your xml file
dipuchandran
01-08-2007, 01:11 PM
I was working on my portfolio site and i created an xml slideshow with the help of postings from this forum. Everything is working fine but when i uploaded my swf in a temporary webspace and tested i noticed a strange thing which i cannot figure out the cause. The setinterval delay time is counting the time of preloading too. so the big size images are sometimes skipped and next image is getting loaded. here is my code.
delay = 10000;
this.fadeSpeed = 5;
this.fadeOutSpeed = 10;
var fadOutInt:Number;
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
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;
}
firstImage();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("main.xml?task=refresh");
/////////////////////////////////////
listen = new Object();
listen.onKeyDown = function() {
if (Key.getCode() == Key.LEFT) {
prevImage();
} else if (Key.getCode() == Key.RIGHT) {
nextImage();
}
};
Key.addListener(listen);
previous_btn.onRelease = function() {
prevact();
};
next_btn.onRelease = function() {
nextact();
};
/////////////////////////////////////
p = 0;
this.onEnterFrame = function() {
filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();
preloader._visible = true;
numload_txt._visible = true;
if (loaded != filesize) {
numload_txt.text = Math.round(loaded/filesize * 100) + " %";
preloader.preload_bar._xscale = 100*loaded/filesize;
} else {
preloader._visible = false;
numload_txt._visible = false;
if (picture._alpha<100) {
picture._alpha += fadeSpeed;
}
}
}
function setstage(){
picture._alpha = 0;
desc_txt._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();
slideshow();
}
function nextImage() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
setstage();
}
}
}
function prevact() {
clearInterval(myInterval);
if (p == 0){
p = total - 2;
} else {
p = p - 2;
}
fadeOut();
}
function nextact() {
clearInterval(myInterval);
fadeOut();
}
function firstImage() {
if (loaded == filesize) {
setstage();
if (total <= 1){
clearInterval(myInterval);
}
}
}
function picture_num() {
current_pos = p+1;
pos_txt.text = current_pos+" / "+total;
}
function slideshow() {
myInterval = setInterval(pause_slideshow, delay);
function pause_slideshow() {
clearInterval(myInterval);
if (p == (total-1)) {
p = 0;
firstImage();
} else {
fadeOut();
}
}
}
function fadeOut() {
fadeOutInt = setInterval(fadeOutImg, fadeOutSpeed);
}
function fadeOutImg(){
if(picture._alpha < 1){
clearInterval(fadeOutInt);
loadNextImg();
}
else{
picture._alpha -= fadeOutSpeed;
desc_txt._alpha -= fadeOutSpeed;
updateAfterEvent(); // refresh according to setInt delay, not framerate
}
}
function loadNextImg() {
if (p == (total-1)) {
p = 0;
firstImage();
} else {
nextImage();
}
}
Pls have a look and help me to figure out why this is happening.
Thank you
spacegypsy
02-16-2007, 12:29 PM
I think this is a great slideshow and the inclusion of links wonderful. However, when i click on my slideshow links, i am getting an "undefined" page, as if i did not specify links, which I did.
Can anyone help me with that?
Were you able to get to the bottom of your problem? I'm having a similar glitch and wondered how you were able to get it to load with out an "undefined" error. It will load but not every time.
Here is the code that I am using:
// load the XML data
xmlData = new XML('<slide><image> image </image><desc> description </desc><url> link </url><altTag> altTag </altTag></slide>');
xmlData.onLoad = loadXML;
xmlData.load("main.xml");
xmlData.ignoreWhite = true;
The script can pop-up a new window. But my question is How can I fix the new popup window size and hide the toolbar?
//getURL statement
//
picture.onRelease = function() {
getURL(link[p],"_blank");
};
//
};
//
fireflip
03-29-2007, 04:13 PM
Hey guys, have any of you been able to use the linking image thing with the thumbnail version? For whatever reason when I click on my main image it open the thumbnail file up in a new window. Thanks in advance for any suggestions!
<five minutes later>Never mind I just figured it out. I'm an idiot.</five minutes later>
mizlatic
04-01-2007, 10:04 PM
Is there anyone that can make solution XML Slideshow with play/pause+back/next+caption that
comming from bottom of page and transition between pictures with some mask effect.And all that without commponents.:puzzled:
mizlatic
04-07-2007, 10:49 PM
Hey everyone,
After a member request, here is a minor modification to the code for the photo gallery and slideshow tutorials. I modified the code from both the tutorials to take into account URL data from the XML file. When somebody clicks on the image, a new web page with the URL will be displayed. I guess that is great for people wanting to show a gigantic version of the image when somebody clicks on it :)
I have attached the photo gallery zip file and the slideshow zip file below. The XML file, HTML, and SWF files are inside the zip file.
Cheers!
Kirupa :ninja:
Can you make next/pause and previous buttons please please please.
ricferr
04-10-2007, 09:11 PM
Hi all, I've addapted this tutorial to use the thumbnails scroller as the main gallery itself (www.eduardacostaferraz.com (http://www.eduardacostaferraz.com)). Since some of the files are bigger than the one preceeding it, they end up one on top of the other. Is there a way to force a specific loading order.
From other threads in this forum, I realised that the problem lies in loading all the files at once. Unfortunetly, I'm not capable of finding out an alternative method to load one at a time.
Any suggestions?
Here's my code:
System.useCodepage = true;
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
thumbnails = [];
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;
thumbnails[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
thumbnails_fn(i);
}
firstImage();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("performances/pics.xml");
/////////////////////////////////////
//listen = new Object();
//listen.onKeyDown = function() {
// if (Key.getCode() == Key.LEFT) {
// prevImage();
// } else if (Key.getCode() == Key.RIGHT) {
// 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 = 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];
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 = 20;
tscroller.onEnterFrame = function() {
if ((_root._ymouse>=thumbnail_mc._y) && (_root._ymouse<=thumbnail_mc._y+thumbnail_mc._height)) {
if ((_root._xmouse>=(hit_right._x-80)) && (thumbnail_mc.hitTest(hit_right))) {
thumbnail_mc._x -= scroll_speed;
} else if ((_root._xmouse<=(hit_left._x+80)) && (thumbnail_mc.hitTest(hit_left))) {
thumbnail_mc._x += 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._x = hit_left._x+(target_mc._width+100)*k;
if (k == 0) {
target_mc._x = hit_left._x;
//Offset from the border of hit_left
} else {
target_mc._x = hit_left._x;
//Offset from the border of hit_left
for (i=0; i<k; i++) {
//Add widths from previous image plus 20 for spacing
target_mc._x = target_mc._x+eval("thumbnail_mc.t"+i)._width+20;
target_mc.setRGB(0xFF0000);
// trace("i = " + i + " Distance = " + target_mc._x); //Debugging information
}
}
target_mc.pictureValue = k;
target_mc.onRelease = function() {
p = this.pictureValue-1;
nextImage();
};
target_mc.onRollOver = function() {
this._alpha = 100;
thumbNailScroller();
};
target_mc.onRollOut = function() {
this._alpha = 80;
};
};
image_mcl = new MovieClipLoader();
image_mcl.addListener(tlistener);
image_mcl.loadClip(thumbnails[k], "thumbnail_mc.t"+k);
}
Thanks
RF
wyclef
04-26-2007, 04:42 PM
Hi there,
Is there a working example of this that preloads the entire set of images at once and then crossfades the images from one to another randomly? That would be really really awesome.
Hybridia
05-10-2007, 01:02 AM
Has anyone had problem of linking "_self" or "_parent" by changing "_blank" line? I'm not sure if I have to change anything else, but the link only works using "_blank" command:
picture.onRelease = function() {
getURL(link[p], "_blank");
};
smileeman2002
06-03-2007, 08:00 PM
Thanks Kirupa...You are a Godsend
smileeman2002
06-03-2007, 08:39 PM
Does this work with the Thumbnail scroller? I get an error:
SecurityDomain 'http://www.kirupa.com/developer/mx2004/pg/kresge.jpg' tried to access incompatible context 'file:///Macintosh%20HD/Users/JUPUB/Desktop/pg%5Fhyperlink%20Folder/pg%5Fhyperlink.swf'
Not sure what this is.
JavaTheHut
06-08-2007, 10:03 PM
Hi All, Here is a little contribution to the T-nail gallery. Making a video gallery using the http://www.kirupa.com/developer/mx2004/xml_flash_photogallery.htm as a base.
Objective: create a thumbnail gallery that would load .jpg's into a movieclip and also .flv files dynamically with XML into a FLVplayback component on the same stage, replace and/or hide the movieclip image loaded when the .flv plays.
-make a sound event on the over state of the thumbnails.
Results: A work around by separating the image gallery and video gallery on the timeline (not a strong coder here!!!) that loads dynamically with XML into a custom video player using a "Video" movie clip??? (found in the "Library" side menu)
Other adjustments:
-over states of the thumbnails use "this.blendMode = 9;" instead of "this._alpha = 50;" this creates a inverse effect
-I adjusted the spacing of the T-nails
Final thoughts:
In my search to do this I found video gallery methods that used component lists but very few used thumbnails but the ones that did where too complicated and required FMS ie: <http://www.adobe.com/devnet/flash/articles/video_player.html>
If anyone can help with my original "Objective" it would be greatly appreciated. I would really like to be able to use the FLVplayback component instead of the custom one I came up with. I read about using "SMIL" file but came up with limited info for this method anyone used this??
Here is the final results I worked on for a friend.
www.thurmanart.com (http://www.thurmanart.com)
Thanks!
-J-
PS. Sorry no .fla files available at this time.
::THERE MAY BE REDUNDANT CODE IN THE FOLLOWING::
/*The following script is based on Kirupa's thumbnail gallery posted at <http://www.kirupa.com/developer/mx2004/xml_flash_photogallery.htm>*/
/////////////*Thank you www.Kirupa.com*//////////////
//////////////////video//////////////////////
var myVideo:Video;
// my_video is a Video object on the Stage
var my_nc:NetConnection = new NetConnection();
my_nc.connect(null);
var my_ns:NetStream = new NetStream(my_nc);
myVideo.attachVideo(my_ns);
//////////////////\video//////////////////////
function loadXML(loaded)
{
if (loaded)
{
xmlNode = this.firstChild;
video = [];
//video
description = [];
thumbnails = [];
//image = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++)
{
video[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
//video
description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
thumbnails[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
//image[i] = xmlNode.childNodes[i].childNodes[3].firstChild.nodeValue;
thumbnails_fn(i);
}
firstImage();
//video
} else
{
content = "file not loaded!";
}
}
///////////////////////////////////////////////
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images/videos.xml");
///////////////////////////////////////////////
listen = new Object();
listen.onKeyDown = function()
{
if (Key.getCode() == Key.LEFT)
{
prevImage();
//video
} else if (Key.getCode() == Key.RIGHT)
{
nextImage();
//video
}
};
Key.addListener(listen);
previous_btn.onRelease = function()
{
prevImage();
//video
};
next_btn.onRelease = function()
{
nextImage();
//video
};
/////////////////////////////////////
////////////////controls/////////////////////
stop_btn.onRelease = function()
{
my_ns.pause(true);
my_ns.seek(0);
};
pause_btn.onRelease = function()
{
if (my_ns.time>0)
{
my_ns.pause();
}
};
play_btn.onRelease = function()
{
my_ns.pause(false);
};
//////////SOUND CONTROLS//////////
var videoSound:Sound = new Sound(sound_mc);
mute_btn.onRelease = function()
{
if (videoSound.getVolume()>0)
{
videoSound.setVolume(0);
} else
{
videoSound.setVolume(100);
}
};
//////////volume/////////////
hiVolume_btn.onRelease = function()
{
videoSound.setVolume(100);
};
medVolume_btn.onRelease = function()
{
videoSound.setVolume(50);
};
loVolume_btn.onRelease = function()
{
videoSound.setVolume(10);
};
///////////////////////////////////////////////
/////////thumbnailWorks////////////////////////
function thumbnails_fn(k)
{
thumbnail_mc.createEmptyMovieClip("t"+k, thumbnail_mc.getNextHighestDepth());
tlistener = new Object();
tlistener.onLoadInit = function(target_mc)
{
target_mc._x = hit_left._x+(target_mc._width+15)*k;
//space between thumbnails
target_mc.pictureValue = k;
target_mc.videoValue = k;
//video
target_mc.onRelease = function()
{
p = this.pictureValue-1;
p = this.videoValue-1;
//video
nextImage();
};
target_mc.onRollOver = function()
{
//this._alpha = 50;
this.createEmptyMovieClip("MovieClip", this.getNextHighestDepth());
this.blendMode = 9;
//T-nail blend mode
thumbNailScroller();
};
target_mc.onRollOut = function()
{
//this._alpha = 100;
this.blendMode = 0;
//T-nail blend mode
};
};
image_mcl = new MovieClipLoader();
image_mcl.addListener(tlistener);
image_mcl.loadClip(thumbnails[k], "thumbnail_mc.t"+k);
}
/////////////////preloader////////////////////
p = 0;
this.onEnterFrame = function()
{
filesize = video.getBytesTotal();
//video
loaded = video.getBytesLoaded();
//video
preloader._visible = true;
if (loaded != filesize)
{
preloader.preload_bar._xscale = 100*loaded/filesize;
} else
{
preloader._visible = false;
if (myVideo._alpha<100)
{
//video
myVideo._alpha += 10;
//video
}
}
};
///////////////\\\\\\\\\\\\\
function nextImage()
{
if (p<(total-1))
{
p++;
if (loaded == filesize)
{
video._alpha = 0;
//picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
my_ns.play(video[p], 1);
//video
picture_num();
}
}
}
function prevImage()
{
if (p>0)
{
p--;
video._alpha = 0;
//picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
my_ns.play(video[p], 1);
//video
picture_num();
}
}
function firstImage()
{
if (loaded == filesize)
{
video._alpha = 0;
//picture.loadMovie(image[0], 1);
desc_txt.text = description[0];
my_ns.play(video[0], 1);
//video paused
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 = 12;
tscroller.onEnterFrame = function()
{
if ((_root._ymouse>=thumbnail_mc._y) && (_root._ymouse<=thumbnail_mc._y+thumbnail_mc._height))
{
if ((_root._xmouse>=(hit_right._x-40)) && (thumbnail_mc.hitTest(hit_right)))
{
thumbnail_mc._x -= scroll_speed;
} else if ((_root._xmouse<=(hit_left._x+40)) && (thumbnail_mc.hitTest(hit_left)))
{
thumbnail_mc._x += scroll_speed;
}
} else
{
delete tscroller.onEnterFrame;
}
};
}
///////////////////endScript/////////////////////
/////////////*Thank you Kirupa.com*//////////////
////////////////////////XML////////////////////////
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<images>
<pic>
<video>images/videos/big_city.flv</video>
<caption>Big City</caption>
<thumbnail>images/videos/thumbnails/big_cityT.jpg</thumbnail>
</pic>
<pic>
<video>images/videos/healthy_walker.flv</video>
<caption>Healthy Walker</caption>
<thumbnail>images/videos/thumbnails/healthy_walkerT.jpg</thumbnail>
</pic>
<pic>
<video>images/videos/left_behind.flv</video>
<caption>Left Behind</caption>
<thumbnail>images/videos/thumbnails/left_behindT.jpg</thumbnail>
</pic>
<pic>
<video>images/videos/passionate.flv</video>
<caption>Passionate</caption>
<thumbnail>images/videos/thumbnails/passionateT.jpg</thumbnail>
</pic>
</images>
////////////////////////////////////////////////
clive
06-13-2007, 07:45 PM
Hi, I've only just found this amazing example of a slideshow and would like to use it, if that's OK. There was no fla file for the slideshow with url links - is it possible for me to get this? I'd like to increase the image size.
Kind regards
Clive
Hey everyone,
After a member request, here is a minor modification to the code for the photo gallery and slideshow tutorials. I modified the code from both the tutorials to take into account URL data from the XML file. When somebody clicks on the image, a new web page with the URL will be displayed. I guess that is great for people wanting to show a gigantic version of the image when somebody clicks on it :)
I have attached the photo gallery zip file and the slideshow zip file below. The XML file, HTML, and SWF files are inside the zip file.
Cheers!
Kirupa :ninja:
artjunky
08-07-2007, 06:22 PM
http://www.amep.com/images/flash/slide1/1.html
When I post this fix with the link adjustment, the images get progressively smaller...Any idea why?
cohengum
11-19-2007, 10:37 PM
Hi, i did the latest Photo Gallery Tutorial where you add the Thumbnails, which worked great - excellent tutorial! (http://www.kirupa.com/developer/mx2004/thumbnails.htm) I just wanted to know - i wanted to add the option so once you clicked on the main image it opened a HTML page. It shows this in the demo of the tutorial but doesn't actually show you how to do it. Can anyone please help, thanks in advance! :)
Monkey_@@
12-10-2007, 08:19 AM
I've implemented this Photo Gallery in my website and it's just GREAT! Thanks Kirupa!
Now I'd like to know if there is a way to pass the xml filename and path as a parameter of the .swf file. I mean, I have several projects with photos and each project has its own subfolder and webpage. So, instead of putting a .swf and a .xml file in each project folder, I'd like to have a single .swf (in a flash folder, for example) and just uniques XML files in the project folders.
Example (FOLDER STRUCTURE):
Flash
|-photogallery.swf
Projects
|-Project_1
|-pr1.htm
|-images_pr1.xml
|-Images
|-img_01.jpg
|-img_02.jpg
|-img_03.jpg
|-Project_2
|-pr2.htm
|-images_pr2.xml
|-Images
|-img_01.jpg
|-img_02.jpg
|-img_03.jpg
|-Project_3
|-pr3.htm
|-images_pr3.xml
|-Images
|-img_01.jpg
|-img_02.jpg
|-img_03.jpg
TIA
M.
cthomasmn
12-27-2007, 05:54 PM
Is there a way to change the XML Slideshow/PhotoGallery so that the images load into different movie clip holders one at a time?
Thanks
ttowle1
01-24-2008, 11:36 AM
Make a movie clip to go under your text. in my case i called the instance "textlink"
Then within you code add this under the picturelink code.
textlink.onRelease = function() {
getURL(link[p]);
};
Can you send me the whole code as I am trying to get this working with the thumbnail version of this tutorial
thx
ttowle1
01-24-2008, 11:51 AM
Make a movie clip to go under your text. in my case i called the instance "textlink"
Then within you code add this under the picturelink code.
textlink.onRelease = function() {
getURL(link[p]);
};
can you provide the complete code for this for thumbnails final fla.
ttowle1
01-24-2008, 12:00 PM
Hey everyone,
After a member request, here is a minor modification to the code for the photo gallery and slideshow tutorials. I modified the code from both the tutorials to take into account URL data from the XML file. When somebody clicks on the image, a new web page with the URL will be displayed. I guess that is great for people wanting to show a gigantic version of the image when somebody clicks on it :)
I have attached the photo gallery zip file and the slideshow zip file below. The XML file, HTML, and SWF files are inside the zip file.
Cheers!
Kirupa :ninja:
Great tutorial but it is missing some code for creating the hyperlinked image which your earlier tutorials provide. Would it be too much to ask that you provide the code for that and also how would I make the caption hyperlink to another webpage?
thx so much inadvance
daistile
06-04-2008, 04:00 PM
I m new here, and I was trying to do something like this and I almost die trying
Thanks a lot !!
atodd66
06-10-2008, 12:00 PM
Hey dipuchandran, I have a question about your code. In the part where you load the XML file, there is some extra code after the file name.
xmlData.load("main.xml?task=refresh");
What does it do? Does it refresh the XML file if you update it? My problem is I am using one of these slideshows and it gets updated on a regular basis. The SWF never gets updated, just the XML, but for some reason, you have to refresh your browser AND clear all your cache and internet files before you will see the new images/text. If anyone else can help it would be greatly appreciated! :)
klefue
06-28-2008, 05:57 PM
hi
maybee this will sound stupid but
how to change this slider into
3 horizontal lines 15 thumbs each
whith 5px gab beetwen them ?
any ideas?
psdesign
07-11-2008, 12:28 AM
Hey everyone,
After a member request, here is a minor modification to the code for the photo gallery and slideshow tutorials. I modified the code from both the tutorials to take into account URL data from the XML file. When somebody clicks on the image, a new web page with the URL will be displayed. I guess that is great for people wanting to show a gigantic version of the image when somebody clicks on it :)
I have attached the photo gallery zip file and the slideshow zip file below. The XML file, HTML, and SWF files are inside the zip file.
Cheers!
Kirupa :ninja:
What about the slideshow with the scrolling thumbnails...I added part of the new code to it but it doesn't really work. Probably it's in a wrong location.
Please help!
Here's part of the code of where I added the getURL. Sorry it's so long:
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
//
//define link variable
//
link = [];
//
thumbnails = [];
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;
thumbnails[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
thumbnails_fn(i);
}
//
//adding links
//
link[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
//
firstImage();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images_w.xml");
/////////////////////////////////////
listen = new Object();
listen.onKeyDown = function() {
if (Key.getCode() == Key.LEFT) {
prevImage();
} else if (Key.getCode() == Key.RIGHT) {
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 = 100*loaded/filesize;
} else {
preloader._visible = false;
if (picture._alpha<100) {
picture._alpha += 10;
}
}
//
//getURL statement
//
picture.onRelease = function() {
getURL(link[p], "_blank");
};
//
};
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._ymouse>=thumbnail_mc._y) && (_root._ymouse<=thumbnail_mc._y+thumbnail_mc._height)) {
if ((_root._xmouse>=(hit_right._x-40)) && (thumbnail_mc.hitTest(hit_right))) {
thumbnail_mc._x -= scroll_speed;
} else if ((_root._xmouse<=(hit_left._x+40)) && (thumbnail_mc.hitTest(hit_left))) {
thumbnail_mc._x += 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._x = hit_left._x+(target_mc._width+5)*k;
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);
}
RobLamb
07-17-2008, 06:52 AM
Can anyone help with this please. I have used both the image gallery and the slideshow in one fla. Basically the client wants to be able to view a slideshow of the images or go through the one by one. Now, I have a couple of problems I need to solve and need some advice. The first is that there are both portrait and landscape images mixed. What happens is that the landscape image end up overlapping the portrait ones.... an issue! The second is that I have created a button that will take the user to the slideshow...but when I go back to the linear gallery, the slideshow stays there!! How do I stop this?? Lastly, I need the images to load from the top/center not from the top/left! You will see what I mean. Please anyone....help me out here please!! As you will see the images are really bad res images so I can upload!!
superstring
07-20-2008, 03:23 PM
I'm using a gallery on separate pages on a site, and for some reason, on a page that only has two thumbnails, both thumbs are linking to the same .html. This doesn't happen on any of the other pages, so I'm guessing it has to do with how the code handles two entries, but I have no clue.
My gallery is modified somewhat. It's a grid, and the links use a javascript popup, but all that is working fine.
Here's my ActionScript:
cliparray = [];
columns = 6;
spacex =110
spacey=80
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
link = [];
description = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
link[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
description[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
}
sload()
} else {
content = "file not loaded!";
}
}
function drawSquare(clip, depth, colour, x, y, w, h) {
var mc = clip.createEmptyMovieClip("clip"+depth, depth);
mc._x = x;
mc._y = y;
mc.lineStyle();
mc.beginFill(colour);
mc.lineTo(w, 0);
mc.lineTo(w, h);
mc.lineTo(0, h);
mc.endFill();
return mc;
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("narrative.xml");
/////////////////////////////////////
var ij=0
function sload() {
for (var i = 0; i<image.length; i++) {
var clip = drawSquare(this, i, 0, 0, 0, 104, 80);
clip._x =71.3+ (i%columns)*spacex;
clip._y =140+ Math.floor(i/columns)*spacey;
var clap =clip.createEmptyMovieClip("tt",1)
var clop =clip.attachMovie("textBox_mc", "textBox_mc", 1000)
clop.i=i
clop.desc.text =description[i]
clap._x = 2
clap._y = 2
clop._x = clap._x - 3;
clop._y = clap._y + 56;
cliparray.push(clap);
cloparray.push(clop);
clip.pictureValue =i;
clip.onRollOver = function() {
this._alpha = 80;
};
clip.onRollOut = function() {
this._alpha = 100;
};
clip.onRelease = function() {
//this.getURL(link[p]);
getURL("javascript:Launch('" + link[ij] + "',650,574)");
//getURL("javascript:NewWindow=window.open('" + link[ij] + "','newWin','width=650,height=574,left=0,top=0,tool bar=No,location=No,scrollbars=No,status=No,resizab le=No,fullscreen=No'); NewWindow.focus(); screen_height = window.screen.availHeight; screen_width = window.screen.availWidth; left_point = parseInt(screen_width/2)-(650/2); top_point = parseInt(screen_height/2)-(574/2); setTimeout('NewWindow.moveTo(left_point,top_point) ',100); void(0);");
};
}
startload()
}
this.createEmptyMovieClip("checker",1000)
function checkload() {
checker.onEnterFrame = function() {
if (cliparray[ij]._width) {
delete this.onEnterFrame;
if (ij<cliparray.length-1) {
ij++;
startload();
}
}
};
}
function startload() {
cliparray[ij].loadMovie(image[ij]);
checkload();
}Here's my xml:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<images>
<pic>
<image>images/thumbnails/narrative/full_throttle.jpg</image>
<link>movies/narrative/coca_cola_full_throttle.html</link>
<caption>FULL THROTTLE</caption>
</pic>
<pic>
<image>images/thumbnails/narrative/help_is_coming.jpg</image>
<link>movies/narrative/help_is_coming.html</link>
<caption>HELP IS COMING</caption>
</pic>
</images>Any ideas? Thanks!
stefan123
07-28-2008, 07:45 AM
hey guys, quick help please. how can i get this link in my xml to open in a "Blank" window. not in "self". here is my xml script
<?xml version="1.0" encoding="utf-8"?>
<item>
<list name="3 Bedrooms, 2.5 Batrooms, Stunning area R 85 000.00" >
<thumb>search\Lynwood\3bed_thumb\lyn30001.jpg</thumb>
<content><![CDATA[<img src="search\Lynwood\3bed_thumb\lyn30001.jpg"/><br>View a 360 degree tour of this propery - <font color="#ff0000"><a href="360_profiles\lynnwood\CraigStanley\index.htm ">CLICK HERE</a></font>]]></content>
</list>
</item>
Please can anyone help
RobLamb
07-28-2008, 08:46 AM
bru... try adding _blank in......
<?xml version="1.0" encoding="utf-8"?>
<item>
<list name="3 Bedrooms, 2.5 Batrooms, Stunning area R 85 000.00" >
<thumb>search\Lynwood\3bed_thumb\lyn30001.jpg</thumb>
<content><![CDATA[<img src="search\Lynwood\3bed_thumb\lyn30001.jpg"/><br>View a 360 degree tour of this propery - <font color="#ff0000"><a href="360_profiles\lynnwood\CraigStanley\index.htm " target="_blank">CLICK HERE</a></font>]]></content>
</list>
</item>
stefan123
07-28-2008, 08:52 AM
wammy, thanks man, my issue was that i was not sure were. thanks alot
RobLamb
07-28-2008, 08:57 AM
cool... no worries!
onaicna
08-01-2008, 06:07 PM
hi did you ever figure out how to add the hyperlink to the main image on the t_scroller gallery?
Abvex
08-02-2008, 07:34 PM
Hi, can anyone help me, I don't know how to add the url addon to the thumbnail version of the tutorial.
I am in the same situation as psdesign.
Abvex
08-04-2008, 12:53 PM
I figure out how to do this in the thumbnail version. Basically you just change the node child number that corespond with the xml file. Of course you need to add the thumbnail fuctions to the actionscript from the tutorial. But I done that already so here it is.
Here is the actionscript.
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
thumbnails = [];
//
//define link variable
//
link = [];
//
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;
thumbnails[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
thumbnails_fn(i);
//
//adding links
//
link[i] = xmlNode.childNodes[i].childNodes[3].firstChild.nodeValue;
//
}
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.LEFT) {
prevImage();
} else if (Key.getCode() == Key.RIGHT) {
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 = 100*loaded/filesize;
} else {
preloader._visible = false;
if (picture._alpha<100) {
picture._alpha += 10;
}
}
//
//getURL statement
//
picture.onRelease = function() {
getURL(link[p], "_blank");
};
//
};
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._ymouse>=thumbnail_mc._y) && (_root._ymouse<=thumbnail_mc._y+thumbnail_mc._height)) {
if ((_root._xmouse>=(hit_right._x-40)) && (thumbnail_mc.hitTest(hit_right))) {
thumbnail_mc._x -= scroll_speed;
} else if ((_root._xmouse<=40) && (thumbnail_mc.hitTest(hit_left))) {
thumbnail_mc._x += 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._x = hit_left._x+(eval("thumbnail_mc.t"+k)._width+5)*k;
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);
}
and here is a sample of the xml file structure you should follow
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<images>
<pic>
<image></image>
<caption></caption>
<thumbnail></thumbnail>
<link></link>
</pic>
<pic>
<image></image>
<caption></caption>
<thumbnail></thumbnail>
<link></link>
</pic>
<pic>
<image></image>
<caption></caption>
<thumbnail></thumbnail>
<link></link>
</pic>
<pic>
<image></image>
<caption></caption>
<thumbnail></thumbnail>
<link></link>
</pic>
</images>
devofash
10-22-2008, 10:11 AM
nice. would you be able to post the .fla of this please
many thanks
vanmemet
11-03-2008, 10:49 AM
i made a xml driven video gallery (slide show) inspired from flashmo slide show. used some cheats to success. any improvement accepted!
http://www.kokdemir.org/flashvideo.rar
Miss Aurelie
11-15-2008, 04:00 AM
Hi! I have built my gallery using the tutorial. It's brilliant, thanks a lot!
I have reorganised/resized it on my animation, and now I have two problems with it:
- the images appear where they are supposed to, but only a small part of them is displayed in the box. I checked their size and it's the same as the movie clip's mask. Don't understand why they appear like "zoomed"
- I have some other links on my animation (menus of the website) and now the links don't work anymore, because when I clic on them, it adds the content of the xml file after the URL...
Sorry, nobody seems to have the same problem, it might be because I'm really not good at programming in AS!!
Thanks for your help!
ricferr
11-15-2008, 08:58 AM
Hi there,
Your post is little messy. However, from the top of my head, I would say that your pictures are zoomed because they're being loaded into a movieclip that might, itself, be zoomed as well. Select the target MC for the pictures and check in the transform panel if it's dimensioned to a 100%.
As to your other issue, I couldn't understand what the problem was.
Good luck
regards
RF
Miss Aurelie
11-17-2008, 01:31 PM
Thanks for your reply! Sorry about the mess ;-)
I've rebuilt it - after spending two hours checking everything - and it now works!
As for the other problem, I solved it as well. I've changed all the links on the page from "GET" to "POST" and now the links are clean. It seems that the AS was adding itself to each link in the URL address... How weird!
vBulletin® v3.7.0, Copyright ©2000-2008, Jelsoft Enterprises Ltd.