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.htmThe 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?
KirupaForum > Flash > Flash 8 (and earlier) > Flash MX
Posted on: 12-27-2004, 04:18 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
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);
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
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);
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
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?
Question On Create A Photo Gallery Tutorial
Hi, If I have photo's with different widths what is the action script to center them in on the stage during the slide show?
thanks for all the help, Ive been slowly working through all the lessons and they are getting me work!
"Create A Photo Gallery" Tutorial Question
Hi - this is my first time posting here.
I've completed the tutorial "Create a Photo Gallery" and I was wondering if it would be possible to click on each photo to go to a certain web page?
"Create A Photo Gallery" Tutorial Question
Hi - this is my first time posting here.
I've completed the tutorial "Create a Photo Gallery" and I was wondering if it would be possible to click on each photo to go to a certain web page?
Kirupa - Create A Photo Gallery, How Could I Put A Caption For Each Photo?
Hi all, im new here i stumbled upon the photo gallery page when looking at how to create one for my website, thanks to sbeener for the code! :-). It works perfectly however how could i change/add to the code so that for a specific photo a certain caption appears which changes for each different photo?
Any ideas will be greatly appreciated.
cheers, alex350r
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;
}
How To Create A Photo Gallery Of Hundreds Of Photo?
I saw the tut for the creating of photo gallery. Is it possible to do a photo gallery like this one (http://www.kriztal.com/flash.html) with hundreds of them? Do i have to key in the Action dialog all the photos' name in it? Is there another method of doing it with the effect of the web site i gave?Pls give some guidance and advice.
I Am Trying To Create A Photo Gallery - Help
I am trying to create a photo gallery and came across a really neat one here http://www.randommedia.co.uk/
How do I go about creating a photo gallery simular to this style with the floating and moving pictures?
Create Photo Gallery Help..
Create a Photo Gallery in "http://www.kirupa.com/developer/mx/photogallery.htm"
i have done it wit step by step that it teach... and it work ok after i convert it into .swf, but when i put into my website... it just doesn't load the pic in my website... it just show the 2 arrow only... and no pic... does anyone know ? can help me ?
Create A Photo Gallery?
look at "Create a Photo Gallery" tutorial by kirupa.
Does anybody ever trying to click the arrow and the photo never change to the next one?
Create A Photo Gallery
Hello sbeener
I have tried to make the example in the tutorial by kirupa chinnathambi, but I work with Flash 8. The example to create a Photo Gallery is probably just for Flash MX because it doesn't work on my computer. Do I have to change codes? Also I don't want to use the buttons, but only have a smooth constant changing show on my homepage. Do I need to change or delete codes?
Thanks !
Greetings from Holland
Create A Photo Gallery
Create a Photo Gallery
code by sbeener :: tutorial by kirupa chinnathambi
Tried it... can't get it to work, nor does the downloaded flash file works? Only on the toturial page can I see it working.
Ideally I want an image gallery within a site. Tried both as its own movie and within an existing movie, nothing works.
What happens is that the first image pops up... then nowthing. I can't even see the arrows for forward and backward. Also the image does not appear where it is auppose to?!
I've put a test version on www.imagevision.dk, where I for example want a picture gallery under the link 'bryllup'.... see what happens? An image appears in the corner and then nothign.
Any help or any news on the script?
Kindly
Sophie
Create A Photo Gallery
To whom can answer this question:
I keep getting errors after following the following tutorial:
http://www.kirupa.com/developer/mx/photogallery.htm
Errors I see:
**Error** Scene=Scene 1, layer=Layer 2, frame=1:Line 2: Syntax error.
written by sbeener (suprabeener)
**Error** Scene=Scene 1, layer=Layer 2, frame=1:Line 21: Syntax error.
falls within pArray.length this.pIndex =
**Error** Scene=Scene 1, layer=Layer 2, frame=1:Line 30: Syntax error.
to load images into var p = _root.photo;
Total ActionScript Errors: 3 Reported Errors: 3
The code i got from KIRUPA site:
//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 = "pictures/";
// fill this array with your pics
this.pArray = ["image0.jpg", "image1.jpg", "image2.jpg", "image3.jpg",
"image4.jpg", "image5.jpg", "image6.jpg", "image7.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);
*******Everything (Pictures and flash file) are in the same folder called (pictures).
Thanks
Create A Photo Gallery
Hi Kirupa,
First of all, big compliment for this site. Clear design and very functional!
As I was learning the "Creat a Photo Gallery"-thing and I noticed that the FLA 5 version didn't work properly on my computer. Of course, I used it in combination with all the images in 'animation' map.
The MX version works fine, can you tell what the problem is?
Thanks!
Grtz, Kevin.
Create A Photo Gallery
i want to know if it is possible to allow the pictures to also link to some site.
the tutorial was code by sbeener :: tutorial by kirupa chinnathambi. O also need the photo gallery to sdisplay 3 pictures at a time...if you could please help me i would grreatly appreciate it. my e-mail is jobasjr@cox.net thanks alot for your time!
How Do I Create A Photo Gallery
i need to create an easy to use photo gallery which loads external images and displays thumbnails and when a user clicks on a thumbnail it shows the image in it's full size (it can load within the movie or a pop up, either way is fine). i want it to load an unlimited amount of photos without having to modify the .fla document. can anyone direct me to a tutorial on how to do this?
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
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!
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
|