XML Photo Gallery Tutorial
hi guys,I need to create a flash photo gallery that loads the photos and photo title with xml but can't seems to b able to find a suitable one.this is what i need to do http://www.afterlights.com/phuket/photo_gallery.htmlbasically the photos, thumbnails and photo description will be all controlled by xmli've created the flash with everything loaded in flash by hard code now, can anyone share any similar tutorial that can do something like this?million thanks in advance!
KirupaForum > Flash > Flash 8 (and earlier)
Posted on: 06-07-2007, 07:40 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Photo Gallery Tutorial Turned Into Photo Carousel
i've taken the tutorial on this site on how to create an flash photo gallery that loads the content from an xml file. i'd like to alter the output of this fine tutorial and would appreciate any help in doing so.
i would like to create gallery, but instead of only showing one picture at a time, i would like to have a carousel effect where more than one picture is shown at a time, and the buttons control the turn of the carousel. i'm thinking in order to do this i'll need to have the as create a movie clip for each picture (maybe during the for loop). each mc instance would have to have a unique name, and then the buttons could play with the properties of each created mc instance.
here's the code from the tutorial on this. any help would be much appreciated....
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("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;
}
}
};
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;
}
Help With Photo Gallery Tutorial...
Hi. I recently made a photo gallery following this tutorial
http://www.kirupa.com/developer/mx2...hotogallery.htm
I have the gallery in a mc in my flash document. The gallery itself works fine. What I am trying to do is have a page with all thumbnails of the pics and when you press each on, it will make the mc visible with the appropriate picture showing. So far I have make a few pages of thumbnails and I have managed to make it so when you press on each thumnail, the mc with the gallery becomes visible. now, on the mc with the gallery, if I change the value of "p" it will change the picture that is first displayed. So, how can I make the value of "p" change depending on which thumbnail I click? I tried making p = to a variable, then I defined the variable on the first frame of the move, but I can't get the value of that variable to change when I click the thumbnail. If Iset a value for the variable on the first frame when I define it, it works. The gallery will open to the picture number I defined, but I still can't get that value to change when I click on the thumbnails. I tried so many different ways I saw on the internet. I tried with global variables too. I'm completely lost here. Please someone help me out because I'm tearing my hair out over here. Here's the flash file incase anybody wants to look at it.
http://www.mypcmechanics.com/lost/8919.zip
also, when the mc opens with the gallery I can still hear all the buttons being activated that are behind the gallery when I move the mouse over the picture. Is there anyway to stop that?
Hope I made sense and thanks for the help
XML Photo Gallery Tutorial
hi guys,
I need to create a flash photo gallery that loads the photos and photo title with xml but can't seems to b able to find a suitable one.
this is what i need to do http://www.afterlights.com/phuket/photo_gallery.html
basically the photos, thumbnails and photo description will be all controlled by xml
i've created the flash with everything loaded in flash by hard code now, can anyone share any similar tutorial that can do something like this?
million thanks in advance!
Help On The Photo Gallery Tutorial
Hi people. I have tried the photo gallery tutorial and I was successful. Bu the funny thing is out of the 8 pictures i put inside the array, only 6 of them managed to appear. Can anyone offer me any solutions? Thanks
The Photo Gallery Tutorial...
i got a question on this tutorial... its fine the way it is with one picture on it.
what i want to really do is have like 3-4 photos on the stage.. if i click "next" it changes all those 4 photos to the next set..etc..
possible?
thx
Help With Photo Gallery Tutorial
Tutorial Link: http://www.kirupa.com/developer/mx/photogallery.htm
The error I'm getting when I try to play the movie/photo album,
NaN
NaN
(etc. over and over again until I x out. It displays in the output box after I transition from the first picture to either direction.)
I'm not sure what he means by d=direction. Am I supposed to fill a variable in? If so, where do I put that number? I'm grateful for any help.
My alteration of the code:
//Code written by sbeener (suprabeener)
/*
i wrote this code, but you can use and abuse it however you like.
the methods are defined in the order which they occur to make it easier to understand.
*/
// variables ------------------------------------------
// put the path to your pics here, include the slashes (ie. "pics/")
// leave it blank if they're in the same directory
this.pathToPics = "http://web.utk.edu/~jwatso13/vacation/";
// fill this array with your pics
this.pArray = ["v2.jpg", "v3.jpg", "v4.jpg", "v5.jpg", "v6.jpg", "v7.jpg"];
this.fadeSpeed = 20;
this.pIndex = 0;
// MovieClip methods ----------------------------------
// d=direction; should 1 or -1 but can be any number
//loads an image automatically when you run animation
loadMovie(this.pathToPics+this.pArray[0], _root.photo);
MovieClip.prototype.changePhoto = function(d) {
// make sure pIndex falls within pArray.length
this.pIndex = (this.pIndex+d)%this.pArray.length;
if (this.pIndex<0) {
this.pIndex += this.pArray.length;
}
this.onEnterFrame = fadeOut;
};
MovieClip.prototype.fadeOut = function() {
if (this.photo._alpha>this.fadeSpeed) {
this.photo._alpha -= this.fadeSpeed;
} else {
this.loadPhoto();
}
};
MovieClip.prototype.loadPhoto = function() {
// specify the movieclip to load images into
var p = _root.photo;
//------------------------------------------
p._alpha = 0;
p.loadMovie(this.pathToPics+this.pArray[this.pIndex]);
this.onEnterFrame = loadMeter;
};
MovieClip.prototype.loadMeter = function() {
var i, l, t;
l = this.photo.getBytesLoaded();
t = this.photo.getBytesTotal();
if (t>0 && t == l) {
this.onEnterFrame = fadeIn;
} else {
trace(l/t);
}
};
MovieClip.prototype.fadeIn = function() {
if (this.photo._alpha<100-this.fadeSpeed) {
this.photo._alpha += this.fadeSpeed;
} else {
this.photo._alpha = 100;
this.onEnterFrame = null;
}
};
// Actions -----------------------------------------
// these aren't necessary, just an example implementation
this.onKeyDown = function() {
if (Key.getCode() == Key.LEFT) {
this.changePhoto(-1);
} else if (Key.getCode() == Key.RIGHT) {
this.changePhoto(1);
}
};
Key.addListener(this);
Photo Gallery Tutorial
well i completed the tutorial on the photo gallery but when i test it, the image and the buttons are not where i want them to be, if you take a look at the attachment, youll see how it looks. Anybody know whats the problem?
Photo Gallery Tutorial.
i was doing the create a photo gallery tutorial [ http://kirupa.com/developer/mx/photogallery.htm ] and everything works correctly execpt that when i have the gallery load inside of a scrollpane it wont work, it seems like its not getting the right directory or something. any sugestions?
MX Photo Gallery Tutorial
I've been playing with this and I have a question. Is it possible to set it to say loading when it's actually loading the next image, otherwise you just get the white screen and someone may think it's not doing anything?
this is a really good forum.
Tutorial: XML Photo Gallery
Hi dudes,
About that XML Photo Gallery tutorial...
What code do I have to change/add if I have a lot of images in a local folder and not online, and want to preload them all in 1 time. I don't want to preload the images one by one, I want to preload them all in 1.
Thx
Tutorial Photo Gallery
Ok I have read through the tutorial on
Photo Gallery
and this is the only part I do not understand
Code:
this.pIndex = (this.pIndex+d)%this.pArray.length;
if (this.pIndex<0) {
this.pIndex += this.pArray.length;
}
I never got how to work that modulo division operator.
That whole section I am confused. I guess because I can't vision how it works. Can someone explain this is detail and simple for stupid people like me.
Thanks in advance
Photo Gallery Tutorial HELP
Hi,
I tried making a photo gallery in flash using the tutorial found on the site. But my pictures are off-centered. Does anyone know what might be the problem? I'm new to flash and can't seem to figure what I'm doing wrong, since i've copied the code from the tutorial.
Please help,
Rye
In Regards To The Photo Gallery Tutorial.
http://www.kirupa.com/developer/mx20..._slideshow.htm
I am very new to flash and action scripting......... so.... how would i make it so that when the user clicks on the image in the slide show....... that image pops up in a larger size
Help:Photo Gallery Tutorial
the code from tutorials works ok for Flash MX but not for Flash 5 , can any one help, im using Flash 5 will soon upgrade to MX.
latin_sydney
/*
i wrote this code, but you can use and abuse it however you like.
the methods are defined in the order which they occur to make it
easier to understand.
*/
// variables ------------------------------------------
// put the path to your pics here, include the slashes (ie. "pics/")
// leave it blank if they're in the same directory
this.pathToPics = "animation/";
// fill this array with your pics
this.pArray = ["image0.jpg", "image1.jpg", "image2.jpg", "image3.jpg", "image4.jpg", "image5.jpg", "image6.jpg", "image7.jpg", "image8.jpg", "image9.jpg"];
this.fadeSpeed = 20;
this.pIndex = 0;
// MovieClip methods ----------------------------------
// d=direction; should 1 or -1 but can be any number
//loads an image automatically when you run animation
loadMovie(this.pathToPics+this.pArray[0], _root.photo);
MovieClip.prototype.changePhoto = function(d) {
// make sure pIndex falls within pArray.length
this.pIndex = (this.pIndex+d)%this.pArray.length;
if (this.pIndex<0) {
this.pIndex += this.pArray.length;
}
this.onEnterFrame = fadeOut;
};
MovieClip.prototype.fadeOut = function() {
if (this.photo._alpha>this.fadeSpeed) {
this.photo._alpha -= this.fadeSpeed;
} else {
this.loadPhoto();
}
};
MovieClip.prototype.loadPhoto = function() {
// specify the movieclip to load images into
var p = _root.photo;
//------------------------------------------
p._alpha = 0;
p.loadMovie(this.pathToPics+this.pArray[this.pIndex]);
this.onEnterFrame = loadMeter;
};
MovieClip.prototype.loadMeter = function() {
var i, l, t;
l = this.photo.getBytesLoaded();
t = this.photo.getBytesTotal();
if (t>0 && t == l) {
this.onEnterFrame = fadeIn;
} else {
trace(l/t);
}
};
MovieClip.prototype.fadeIn = function() {
if (this.photo._alpha<100-this.fadeSpeed) {
this.photo._alpha += this.fadeSpeed;
} else {
this.photo._alpha = 100;
this.onEnterFrame = null;
}
};
// Actions -----------------------------------------
// these aren't necessary, just an example implementation
this.onKeyDown = function() {
if (Key.getCode() == Key.LEFT) {
this.changePhoto(-1);
} else if (Key.getCode() == Key.RIGHT) {
this.changePhoto(1);
}
};
Key.addListener(this);
Photo Gallery Tutorial A Lil Help
Hey all I just finished reading through the two gallery tutorials on this site the first here http://www.kirupa.com/developer/mx20...otogallery.htm and the second to add thumnails to the gallery found here http://www.kirupa.com/developer/mx2004/thumbnails.htm.
I just had two questions on how to modify the gallery. The first question is in the begining of the add thumbnails tutorial its shows and option to display the thumbnails in a grid. I was wondering how would I go about making that grid totally lost any help to achieve this would be great. Is it possible to get the thumnails to be listed in the list box component.
My second question is I know how the description text of each image is called. But I wanted to create a pop up buble graphic that if you rolled over and information icon it would display the pop up graphic with description to the corresponding image.
Last quick question how do i change the width and height of the thumbnail images inside the scroller.
Thanx for any help
Xml Photo Gallery Tutorial
hi, i used the xml photo/thumb tutorial with some modifications and it seems to only be working when viewed in firefox, not with IE. in addition, it doesnt preview properly in flash. everything seems to be in order, but any ideas as to what may be happening?
forgot the code:
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;
thumbnails[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
thumbnails_fn(i);
}
firstImage();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("gallery.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);
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 ((this._ymouse>=thumbnail_mc._y) && (this._ymouse<=thumbnail_mc._y+thumbnail_mc._heigh t)) {
if ((this._xmouse>=(hit_right._x-40)) && (thumbnail_mc.hitTest(hit_right))) {
thumbnail_mc._x -= scroll_speed;
} else if ((this._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);
}
and the gallery.xml code is:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<images>
<pic>
<image>photos/photo-01.jpg</image>
<thumbnail>thumbs/photo-01.jpg</thumbnail>
</pic>
[etc. with pic array]
</images>
Help With The Photo Gallery Tutorial Please..
hello.
I'm sorry if this has been answered in a previous thread, I searched but found nothing.
I am working with the Flash MX photo gallery that is posted in the tutorial section, and I seemed to have run into a snag.
I replaced the images (image0 - image9) with my own images that I want to use with the slideshow, and those images don't get recognized. I tried naming them the same and naming them differently and changing the code to reflect that, but they still do not come up in the slideshow.
Am I doing something wrong here. I am at wits end as to what else to try. any help is appreciated.
XML Photo Gallery Tutorial
Hi,
Hope someone can help, when I try to open the fla on this thread > http://www.kirupa.com/developer/mx20...otogallery.htm
it comes up with 'Failed to open'. Can anyone shed any light on this? This would be a REALLY handy tutorial as it is exactly what I need to accomplish for a project I am about to start!
Thanks in advance
PS - I 'am' opening the correct verion (flash 2004)
Photo Gallery Tutorial
Hi,everybody. I was wondering if i could get some help or guided in the right direction in finding my answer. I did this photo gallery tutorial (http://www.kirupa.com/developer/mx/photogallery.htm). I magment get everything to work but when i put the script in a moveClip that goes on my main time line, it doesn't work. ideally i would like to put the script in a swf that will load in to may main movie. If somebody could help that would be grate.
This is what the script looks like.
// variables ------------------------------------------
// put the path to your pics here, include the slashes (ie. "pics/")
// leave it blank if they're in the same directory
this.pathToPics = "animation/";
// fill this array with your pics
this.pArray = ["image0.jpg", "image1.jpg", "image2.jpg", "image3.jpg", "image4.jpg", "image5.jpg", "image6.jpg", "image7.jpg", "image8.jpg", "image9.jpg", "image10.jpg","image11.jpg", "image12.jpg","image13.jpg","image14.jpg","image15 .jpg","image16.jpg","image17.jpg","image18.jpg","i mage19.jpg","image20.jpg"
];
this.fadeSpeed = 20;
this.pIndex = 0;
// MovieClip methods ----------------------------------
// d=direction; should 1 or -1 but can be any number
//loads an image automatically when you run animation
loadMovie(this.pathToPics+this.pArray[0], _root.photo);
MovieClip.prototype.changePhoto = function(d) {
// make sure pIndex falls within pArray.length
this.pIndex = (this.pIndex+d)%this.pArray.length;
if (this.pIndex<0) {
this.pIndex += this.pArray.length;
}
this.onEnterFrame = fadeOut;
};
MovieClip.prototype.fadeOut = function() {
if (this.photo._alpha>this.fadeSpeed) {
this.photo._alpha -= this.fadeSpeed;
} else {
this.loadPhoto();
}
};
MovieClip.prototype.loadPhoto = function() {
// specify the movieclip to load images into
var p = _root.photo;
//------------------------------------------
p._alpha = 0;
p.loadMovie(this.pathToPics+this.pArray[this.pIndex]);
this.onEnterFrame = loadMeter;
};
MovieClip.prototype.loadMeter = function() {
var i, l, t;
l = this.photo.getBytesLoaded();
t = this.photo.getBytesTotal();
if (t>0 && t == l) {
this.onEnterFrame = fadeIn;
} else {
trace(l/t);
}
};
MovieClip.prototype.fadeIn = function() {
if (this.photo._alpha<100-this.fadeSpeed) {
this.photo._alpha += this.fadeSpeed;
} else {
this.photo._alpha = 100;
this.onEnterFrame = null;
}
};
// Actions -----------------------------------------
// these aren't necessary, just an example implementation
this.onKeyDown = function() {
if (Key.getCode() == Key.LEFT) {
this.changePhoto(-1);
} else if (Key.getCode() == Key.RIGHT) {
this.changePhoto(1);
}
};
Key.addListener(this);
Photo Gallery Tutorial Help
Hi all,
I have used the Photo Gallery (with scrolling thumbnails) tutorial on kirupa.com as the basis for a project I am working on for my client. Basically, they have 8 different categories of products they want to show images of, so I set up 8 different xml and swf files that are loaded into a level from a main swf that holds the nav buttons.
My question: Is there a way to add some script that when you reach the end of one category, that it will then load the next category on the final "next" button hit? In other words, there are 5 images to load in category 1, you click through that category and when you come to the last image, you click next again and it will then load category 2 swf?
Thanks in advance
Photo Gallery Tutorial Help
Hi Im relatively new to actionscripting and im trying to modify the photo gallery tutorial which is on this site. I have provided the code below. Basically i have modified the original script with the help of other tutorials on this site. So right now i have it automatically changing between images with an interval of 3 seconds and also displaying the array of images in a random sequence. What i really, really, really, really want it to do from here is to load this movie onto multiple movieclip targets situated on the stage, so that there are like 6 instances of the movie on stage.
If anyone could help me i would greatly appreciate it!!!
my script:
// variables ------------------------------------------
// put the path to your pics here, include the slashes (ie. "pics/")
// leave it blank if they're in the same directory
this.pathToPics = "image_files/";
// fill this array with your pics
this.pArray = ["2.jpg", "3.jpg", "4.jpg","5.jpg","6.jpg","7.jpg","8.jpg"];
this.fadeSpeed = 20;
this.pIndex = 0;
// MovieClip methods ----------------------------------
// d=direction; should 1 or -1 but can be any number
//loads an image automatically when you run animation
loadMovie(this.pathToPics+this.pArray[0], _root.myMC1);
MovieClip.prototype.changePhoto = function(d) {
// make sure pIndex falls within pArray.length
this.pIndex = (this.pIndex+d)%this.pArray.length;
if (this.pIndex<0) {
this.pIndex += this.pArray.length;
}
this.onEnterFrame = fadeOut;
};
MovieClip.prototype.fadeOut = function() {
if (this.myMC1._alpha>this.fadeSpeed) {
this.myMC1._alpha -= this.fadeSpeed;
} else {
this.loadPhoto();
}
};
MovieClip.prototype.loadPhoto = function() {
// specify the movieclip to load images into
var p = _root.myMC1;
//------------------------------------------
p._alpha = 0;
p.loadMovie(this.pathToPics+this.pArray[this.pIndex]);
this.onEnterFrame = loadMeter;
};
MovieClip.prototype.loadMeter = function() {
var i, l, t;
l = this.myMC1.getBytesLoaded();
t = this.myMC1.getBytesTotal();
if (t>0 && t == l) {
this.onEnterFrame = fadeIn;
} else {
trace(l/t);
}
};
MovieClip.prototype.fadeIn = function() {
if (this.myMC1._alpha<100-this.fadeSpeed) {
this.myMC1._alpha += this.fadeSpeed;
} else {
this.myMC1._alpha = 100;
this.onEnterFrame = null;
}
};
//change photos
this.randomPhoto = function() {
this.pIndex = Math.floor(Math.random()*pArray.length);
this.onEnterFrame = fadeOut;
};
interval = setInterval(this, "randomPhoto", 3000);
this.onEnterFrame = null;
[CS3] Photo Gallery Tutorial
Hey i read your tutorial on Creating a Photo Gallery:
http://www.kirupa.com/developer/mx/photogallery.htm
I've been trying to figure out how to activate the script when I click on a button - as in loadmovie into a blank mc.
For example I click on "project1" and it loads "image1.1" "image1.2" and "image1.3" ; I click on "project2" and it loads "image2.1" "image2.2" and "image2.3" etc.
Can't get it working though.
Photo Gallery Tutorial
In reference to this tutorial:
http://www.kirupa.com/developer/mx/photogallery.htm
I was wondering how to load portrait pictures as well as landscape. I can resize pictures so that they fit in the window, but all portrait pictures end up on the left side of the movie. Is there a way that I can simply center portrait pictures?
Thanks!
Brett
Photo Gallery Tutorial Help
I have just tried doing the "Create a Photo Gallery" tutorial:http://www.kirupa.com/developer/mx/photogallery.htm
It kind of works, but it is only showing one picture. What am i doing wrong? here is the code:
//Code written by sbeener (suprabeener)
/*
i wrote this code, but you can use and abuse it however you like.
the methods are defined in the order which they occur to make it
easier to understand.
*/
// variables ------------------------------------------
// put the path to your pics here, include the slashes (ie. "pics/")
// leave it blank if they're in the same directory
this.pathToPics = "";
// fill this array with your pics
this.pArray = ["pic2.jpg", "pic1.jpg"];
this.fadeSpeed = 20;
this.pIndex = 0;
// MovieClip methods ----------------------------------
// d=direction; should 1 or -1 but can be any number
//loads an image automatically when you run animation
loadMovie(this.pathToPics+this.pArray[0], _root.photo);
MovieClip.prototype.changePhoto = function(d) {
// make sure pIndex falls within pArray.length
this.pIndex = (this.pIndex+d)%this.pArray.length;
if (this.pIndex<0) {
this.pIndex += this.pArray.length;
}
this.onEnterFrame = fadeOut;
};
MovieClip.prototype.fadeOut = function() {
if (this.photo._alpha>this.fadeSpeed) {
this.photo._alpha -= this.fadeSpeed;
} else {
this.loadPhoto();
}
};
MovieClip.prototype.loadPhoto = function() {
// specify the movieclip to load images into
var p = _root.photo;
//------------------------------------------
p._alpha = 0;
p.loadMovie(this.pathToPics+this.pArray[this.pIndex]);
this.onEnterFrame = loadMeter;
};
MovieClip.prototype.loadMeter = function() {
var i, l, t;
l = this.photo.getBytesLoaded();
t = this.photo.getBytesTotal();
if (t>0 && t == l) {
this.onEnterFrame = fadeIn;
} else {
trace(l/t);
}
};
MovieClip.prototype.fadeIn = function() {
if (this.photo._alpha<100-this.fadeSpeed) {
this.photo._alpha += this.fadeSpeed;
} else {
this.photo._alpha = 100;
this.onEnterFrame = null;
}
};
// Actions -----------------------------------------
// these aren't necessary, just an example implementation
this.onKeyDown = function() {
if (Key.getCode() == Key.LEFT) {
this.changePhoto(-1);
} else if (Key.getCode() == Key.RIGHT) {
this.changePhoto(1);
}
};
Key.addListener(this);
Both pictures are in the same file and labled and named correctly. Can anyone help? Thanks very much.
The Photo Gallery Tutorial...
i got a question on this tutorial... its fine the way it is with one picture on it.
what i want to really do is have like 3-4 photos on the stage.. if i click "next" it changes all those 4 photos to the next set..etc..
possible?
thx
Help With Photo Gallery Tutorial
Tutorial Link: http://www.kirupa.com/developer/mx/photogallery.htm
The error I'm getting when I try to play the movie/photo album,
NaN
NaN
(etc. over and over again until I x out. It displays in the output box after I transition from the first picture to either direction.)
I'm not sure what he means by d=direction. Am I supposed to fill a variable in? If so, where do I put that number? I'm grateful for any help.
My alteration of the code:
//Code written by sbeener (suprabeener)
/*
i wrote this code, but you can use and abuse it however you like.
the methods are defined in the order which they occur to make it easier to understand.
*/
// variables ------------------------------------------
// put the path to your pics here, include the slashes (ie. "pics/")
// leave it blank if they're in the same directory
this.pathToPics = "http://web.utk.edu/~jwatso13/vacation/";
// fill this array with your pics
this.pArray = ["v2.jpg", "v3.jpg", "v4.jpg", "v5.jpg", "v6.jpg", "v7.jpg"];
this.fadeSpeed = 20;
this.pIndex = 0;
// MovieClip methods ----------------------------------
// d=direction; should 1 or -1 but can be any number
//loads an image automatically when you run animation
loadMovie(this.pathToPics+this.pArray[0], _root.photo);
MovieClip.prototype.changePhoto = function(d) {
// make sure pIndex falls within pArray.length
this.pIndex = (this.pIndex+d)%this.pArray.length;
if (this.pIndex<0) {
this.pIndex += this.pArray.length;
}
this.onEnterFrame = fadeOut;
};
MovieClip.prototype.fadeOut = function() {
if (this.photo._alpha>this.fadeSpeed) {
this.photo._alpha -= this.fadeSpeed;
} else {
this.loadPhoto();
}
};
MovieClip.prototype.loadPhoto = function() {
// specify the movieclip to load images into
var p = _root.photo;
//------------------------------------------
p._alpha = 0;
p.loadMovie(this.pathToPics+this.pArray[this.pIndex]);
this.onEnterFrame = loadMeter;
};
MovieClip.prototype.loadMeter = function() {
var i, l, t;
l = this.photo.getBytesLoaded();
t = this.photo.getBytesTotal();
if (t>0 && t == l) {
this.onEnterFrame = fadeIn;
} else {
trace(l/t);
}
};
MovieClip.prototype.fadeIn = function() {
if (this.photo._alpha<100-this.fadeSpeed) {
this.photo._alpha += this.fadeSpeed;
} else {
this.photo._alpha = 100;
this.onEnterFrame = null;
}
};
// Actions -----------------------------------------
// these aren't necessary, just an example implementation
this.onKeyDown = function() {
if (Key.getCode() == Key.LEFT) {
this.changePhoto(-1);
} else if (Key.getCode() == Key.RIGHT) {
this.changePhoto(1);
}
};
Key.addListener(this);
Photo Gallery Tutorial
well i completed the tutorial on the photo gallery but when i test it, the image and the buttons are not where i want them to be, if you take a look at the attachment, youll see how it looks. Anybody know whats the problem?
Photo Gallery Tutorial
Hi,
Im having problems with the Create a Photo Gallery tutorial and Flash MX, when i run the movie and want it to load images from another directory on the website http://www.sold-out.co.uk/test/produ...reens/commbel/ you have to click the forward and back buttons twice.
When i test the movie in flash the first image loads fine, then when i click the forward or back button in the output box it just keeps saying NaN, can anyone tell me how to solve this problem.
Thank You in advance.
Lee
MX Photo Gallery Tutorial
I've been playing with this and I have a question. Is it possible to set it to say loading when it's actually loading the next image, otherwise you just get the white screen and someone may think it's not doing anything?
this is a really good forum.
Photo Gallery Tutorial
Hello All,
I have a question about customizing the photo gallery tutorial. As well as having the user being able to scroll through the pictures, I would like them to be able to click on a thumb nail version of the picture below. The back and forwards buttons use:
on (release) {
_root.changePhoto(-1);
}
so I imagine I would use similar code on each on the thumb nail buttons to go to a specific picture.
Thanks in advance.
Robert
Tutorial: XML Photo Gallery
Hi dudes,
About that XML Photo Gallery tutorial...
What code do I have to change/add if I have a lot of images in a local folder and not online, and want to preload them all in 1 time. I don't want to preload the images one by one, I want to preload them all in 1.
Thx
Photo Gallery Tutorial HELP
Hi,
I tried making a photo gallery in flash using the tutorial found on the site. But my pictures are off-centered. Does anyone know what might be the problem? I'm new to flash and can't seem to figure what I'm doing wrong, since i've copied the code from the tutorial.
Please help,
Rye
In Regards To The Photo Gallery Tutorial.
http://www.kirupa.com/developer/mx20..._slideshow.htm
I am very new to flash and action scripting......... so.... how would i make it so that when the user clicks on the image in the slide show....... that image pops up in a larger size
Photo Gallery Tutorial
Hello there,
I am having some difficulty getting the photo gallery to work. The problem is in the code:
this.PathToPics = "animation";
When I get here in the code I put in the direct path where the file "animation" is stored on my hard drive so it looks something like this:
this.PathToPics = "c:documentsandsettings/art/flash/flashprojects/animation";
I was using the folder with the animal pics in it named animation.
Anyhow, when I go to test the movie I get a message:
Error opening URL "c:documents and settings/art/flash/flash projects/animationimage0.jpg"
can you tell me how I am supposed to target this file on my c drive?
Also, is there any other code that could be added to this that would allow for the photo show to move on it's own ever 4 seconds or so on a continuous loop?
Thanks,
dig
Good Photo Gallery Tutorial
I followed a tutorial that I found online and it gave me some decent results but I'm looking to improve my current photo gallery to make a little bit prettier but I'm not sure what to do, or what would be a good tutorial to follow. Any tips?
Here's my current gallery: http://asdfdesign.freehostia.com/design.html
Also, a lot of the pictures get loaded and they look very blurry or jagged when the original pictures don't look that way. Any idea why?
Create A Photo Gallery Tutorial
I used this tutorial http://www.kirupa.com/developer/mx/photogallery.htm
I ahve everything working, but the images are loading in the bottom left corner of my swf. It does not seem like it is loading into my movieclip. Any thoughts?
J
HERE IS THE CODE FOR THE MOVIECLIP: the instance name of my clip is "photo"
//Code written by sbeener (suprabeener)
/*
i wrote this code, but you can use and abuse it however you like.
the methods are defined in the order which they occur to make it
easier to understand.
*/
// variables ------------------------------------------
// put the path to your pics here, include the slashes (ie. "pics/")
// leave it blank if they're in the same directory
this.pathToPics = "animation/";
// fill this array with your pics
this.pArray = ["image0.jpg", "image1.jpg", "image2.jpg", "image3.jpg", "image4.jpg", "image5.jpg", "image6.jpg", "image7.jpg", "image8.jpg", "image9.jpg"];
this.fadeSpeed = 20;
this.pIndex = 0;
// MovieClip methods ----------------------------------
// d=direction; should 1 or -1 but can be any number
//loads an image automatically when you run animation
loadMovie(this.pathToPics+this.pArray[0], _root.photo);
MovieClip.prototype.changePhoto = function(d) {
// make sure pIndex falls within pArray.length
this.pIndex = (this.pIndex+d)%this.pArray.length;
if (this.pIndex<0) {
this.pIndex += this.pArray.length;
}
this.onEnterFrame = fadeOut;
};
MovieClip.prototype.fadeOut = function() {
if (this.photo._alpha>this.fadeSpeed) {
this.photo._alpha -= this.fadeSpeed;
} else {
this.loadPhoto();
}
};
MovieClip.prototype.loadPhoto = function() {
// specify the movieclip to load images into
var p = _root.photo;
//------------------------------------------
p._alpha = 0;
p.loadMovie(this.pathToPics+this.pArray[this.pIndex]);
this.onEnterFrame = loadMeter;
};
MovieClip.prototype.loadMeter = function() {
var i, l, t;
l = this.photo.getBytesLoaded();
t = this.photo.getBytesTotal();
if (t>0 && t == l) {
this.onEnterFrame = fadeIn;
} else {
trace(l/t);
}
};
MovieClip.prototype.fadeIn = function() {
if (this.photo._alpha<100-this.fadeSpeed) {
this.photo._alpha += this.fadeSpeed;
} else {
this.photo._alpha = 100;
this.onEnterFrame = null;
}
};
// Actions -----------------------------------------
// these aren't necessary, just an example implementation
this.onKeyDown = function() {
if (Key.getCode() == Key.LEFT) {
this.changePhoto(-1);
} else if (Key.getCode() == Key.RIGHT) {
this.changePhoto(1);
}
};
Key.addListener(this);
Photo Gallery Tutorial Issue
I finished the photo gallery tutorial, and I'm having an issue with it. When you play the photo gallery, the pictures coming up in the lower right hand corner. I found this issue posted on the forum, to be honest with you, i have no idea what the fix was ... could someone do me the favor of looking at my files and let me know what i need to do to fix it?
Z
(it keeps telling me that my file is too big (and it's not) so i'm going to have to break them up into about 3 differnt postings
Problems With Photo Gallery Tutorial
I got the photo gallery to work, but the photos appear in the lower right hand corner of my animation, i have been trying to figure out why for quite some time now, so now i give up and ask if anyone can tell me why, and what i need to change to get the photos to load in the center of the movie i specified. I did everything just like in the tutorial, i used the same code, except for changing the images to load. The fla is attached if needed, and here is the code i used:
this.pathToPics = "";
this.pArray = [“scarlet1.jpg”, “scarlet2.jpg”, “scarlet3.jpg”];
this.fadeSpeed = 20;
this.pIndex = 0;
loadMovie(this.pathToPics+this.pArray[0], _root.photo);
MovieClip.prototype.changePhoto = function(d) {
// make sure pIndex falls within pArray.length
this.pIndex = (this.pIndex+d)%this.pArray.length;
if (this.pIndex<0) {
this.pIndex += this.pArray.length;
}
this.onEnterFrame = fadeOut;
};
MovieClip.prototype.fadeOut = function() {
if (this.photo._alpha>this.fadeSpeed) {
this.photo._alpha -= this.fadeSpeed;
} else {
this.loadPhoto();
}
};
MovieClip.prototype.loadPhoto = function() {
var p = _root.photo;
p._alpha = 0;
p.loadMovie(this.pathToPics+this.pArray[this.pIndex]);
this.onEnterFrame = loadMeter;
};
MovieClip.prototype.loadMeter = function() {
var i, l, t;
l = this.photo.getBytesLoaded();
t = this.photo.getBytesTotal();
if (t>0 && t == l) {
this.onEnterFrame = fadeIn;
} else {
trace(l/t);
}
};
MovieClip.prototype.fadeIn = function() {
if (this.photo._alpha<100-this.fadeSpeed) {
this.photo._alpha += this.fadeSpeed;
} else {
this.photo._alpha = 100;
this.onEnterFrame = null;
}
};
this.onKeyDown = function() {
if (Key.getCode() == Key.LEFT) {
this.changePhoto(-1);
} else if (Key.getCode() == Key.RIGHT) {
this.changePhoto(1);
}
};
Key.addListener(this);
Any help would be much appreciated. Thanks a lot!
Create A Photo Gallery Tutorial
this is a great turtorial. The only problem is I am having a hard time getting it to work for Flash 5. I downloaded the Flash 5 version and when I tried to test it I got this error message:Error opening URL "file:///C|/DOCUME%7E1/SUZANN%7E1/LOCALS%7E1/Temp/Rar%24DI03.344/animation/image0.jpg"
Any suggestions how I can get this MX version to work with flash 5? My images are just not loading at all.
The MX version works fine. But I have not worked in MX I am more comfortable with 5. I will make the switch once I am through with this project.
thanks
SuzyQ
Create A Photo Gallery Tutorial
Create a Photo Gallery Tutorial
http://www.kirupa.com/developer/mx/photogallery.htm
I found this great tutorial on Kirupa.com, the link is above. It works in MX but not flash 5, I get this error message:
Error opening URL "file:///C|/DOCUME%7E1/SUZANN%7E1/LOCALS%7E1/Temp/Rar%24DI03.344/animation/image0.jpg"
I posted my concern in the MX forum and some responded you "you cannot load images dynamically using Flash 5"
I have tried absolute and relative paths to link to images in my directory. I still get an error message? So I am wondering if anyone knows how I can do make this photo gallery work using flash 5?
Help
Suzy Q
Kirupa Photo Gallery Tutorial
I used this tutorial (http://www.kirupa.com/developer/mx/photogallery.htm)and everything worked great but i also wanted to other images to load in a different loadbox at the same time. (Using the same button) Not being in expert in action script, i duplicated the code, changed all the variable names accordingly but i had a problem. The 2 scripts don't seem to work together. One loads the images properly and the other doen't. If i take 1 off, the other works and vice-versa. I am sure i changed all the variable names but they still conflict somehow.
Any ideas.
Code:
this.pathToPics = "images/";
this.pArray = ["journeys0.jpg", "journeys1.jpg", "journeys2.jpg"];
this.fadeSpeed = 10;
this.pIndex = 0;
loadMovie(this.pathToPics+this.pArray[0], _root.loadbox);
MovieClip.prototype.changePhoto = function(d) {
// make sure pIndex falls within pArray.length
this.pIndex = (this.pIndex+d)%this.pArray.length;
if (this.pIndex<0) {
this.pIndex += this.pArray.length;
}
this.onEnterFrame = fadeOut;
};
MovieClip.prototype.fadeOut = function() {
if (this.loadbox._alpha>this.fadeSpeed) {
this.loadbox._alpha -= this.fadeSpeed;
} else {
this.loadPhoto();
}
};
MovieClip.prototype.loadPhoto = function() {
// specify the movieclip to load images into
var p = _root.loadbox;
//------------------------------------------
p._alpha = 0;
p.loadMovie(this.pathToPics+this.pArray[this.pIndex]);
this.onEnterFrame = loadMeter;
};
MovieClip.prototype.loadMeter = function() {
var i, l, t;
l = this.loadbox.getBytesLoaded();
t = this.loadbox.getBytesTotal();
if (t>0 && t == l) {
this.onEnterFrame = fadeIn;
} else {
trace(l/t);
}
};
MovieClip.prototype.fadeIn = function() {
if (this.loadbox._alpha<100-this.fadeSpeed) {
this.loadbox._alpha += this.fadeSpeed;
} else {
this.loadbox._alpha = 100;
this.onEnterFrame = null;
}
};
//------------------The other loadingbox-------------------
this.pathToPics = "images/";
// fill this array with your pics
this.nArray = ["1of3.swf", "2of3.swf", "3of3.swf"];
this.fadeSpeed2 = 10;
this.nIndex = 0;
// MovieClip methods ----------------------------------
// d=direction; should 1 or -1 but can be any number
//loads an image automatically when you run animation
loadMovie(this.pathToPics+this.nArray[0], _root.numbox);
MovieClip.prototype.changeNum = function(d2) {
// make sure pIndex falls within pArray.length
this.nIndex = (this.nIndex+d2)%this.nArray.length;
if (this.nIndex<0) {
this.nIndex += this.nArray.length;
}
this.onEnterFrame = fadeOut2;
};
MovieClip.prototype.fadeOut2 = function() {
if (this.numbox._alpha>this.fadeSpeed2) {
this.numbox._alpha -= this.fadeSpeed2;
} else {
this.loadNum();
}
};
MovieClip.prototype.loadNum = function() {
// specify the movieclip to load images into
var num = _root.numbox;
//------------------------------------------
num._alpha = 0;
num.loadMovie(this.pathToPics+this.nArray[this.nIndex]);
this.onEnterFrame = loadMeter2;
};
MovieClip.prototype.loadMeter2 = function() {
var i2, l2, t2;
l2 = this.numbox.getBytesLoaded();
t2 = this.numbox.getBytesTotal();
if (t2>0 && t2 == l2) {
this.onEnterFrame = fadeIn2;
} else {
trace(l2/t2);
}
};
MovieClip.prototype.fadeIn2 = function() {
if (this.numbox._alpha<100-this.fadeSpeed2) {
this.numbox._alpha += this.fadeSpeed2;
} else {
this.numbox._alpha = 100;
this.onEnterFrame = null;
}
};
Problem With The Photo Gallery Tutorial
Why is the picture not centering in the stage in this tutorial eventhough I setted the movie clip in the center?
http://kirupa.com/developer/mx/photogallery.htm
Photo Gallery Using XML And Flash Tutorial
I have used the Tutorial to build what I basically wanted, one thing though, how do you add another xml entry for picking up the relevant field in the xml doc?
Here is the code and the //NOTE is where I have added the code that I thought would work.
Code:
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
body = [];//NOTE
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;
body[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;//NOTE
}
firstImage();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("tester.xml");
/////////////////////////////////////
listen = new Object();
listen.onKeyDown = function()
{
if (Key.getCode() == Key.LEFT)
{
prevImage();
}
else if (Key.getCode() == Key.RIGHT)
{
nextImage();
}
}
Key.addListener(listen);
mcPrevious.onRelease = function()
{
prevImage();
}
mcNext.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];
body_txt.text = body[p];//NOTE
picture_num();
}
}
}
function prevImage() {
if (p>0) {
p--;
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
body_txt.text = body[p];//NOTE
picture_num();
}
}
function firstImage() {
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[0], 1);
desc_txt.text = description[0];
body_txt.text = body[0];//NOTE
picture_num();
}
}
function picture_num() {
current_pos = p+1;
pos_txt.text = current_pos+" / "+total;
}
My entry in the xml file is called <body>This is the body description</body>
I am hoping someone can help me out?
Thanks in advance
Photo Gallery Tutorial Not Working
I even tried downloading the complete XML Photo Gallery Flash MX fla file and it still didn't work. Only thing I did was edit the "images" XML file. I not getting any file opening errors. Please help me.
Tutorial-create A Photo Gallery
I'm learning this great tutorial on creating a photo gallery. I even understood most of the actionscript.
http://www.kirupa.com/developer/mx/photogallery.htm
The tutorial is using pics of all the same size. What about pics of different size being always positioned in the center of the movie?
I was thinking of something like to find the x of each pics by deducing the width of the pic of the width of the container divided by 2. Would it work? How to traduce that in as? And add it to the codes of the above photo gallery?
|