Hi, this is my first message on these forums. I really like the site and it’s gotten me out of a flash-related fix more than once. I was just wondering, because I’m still an amateur at flash (more precisely, actionscript), could anyone explain how to do a simple gallery with static thumbnails which, when clicked, dynamically load an image into an empty movie clip, fading in and out (using actionscript)? By that I mean, click on a thumbnail, main image fades in, click on another thumbnail, loaded image fades out, image of clicked thumbnail fades in. Is it possible?
I have successfully achieved thumbnails that load an image externally using both XML and using the ordinary loadMovie function, opting in the end for the loadMovie function and modifying AnaS’ (http://www.tutorial5.com/content/view/166/46/) code (some of his comments are still in there). The reasons being that I’m not particularly concerned if I can’t use XML for this, but I do want the images to load externally to save space. I figure that the thumbnails are small enough in file size for me to afford to put them in, but just in case anyone think that XML is better for the job, I’m also including my XML file.
On top of AnaS’ code, I have added an if-else statement (lines 13-21) but, as I have said before, I’m an amateur, so I can get my head around the ‘if’ part of the statement, but haven’t figured out the ‘else’ section (namely, the fade out). From what I have seen (I’ve been looking for the solution for a long time), most people just settle for fading the image either in or out, but rarely both. If there IS a gallery with both fades, it is usually done professionally and the code is either unavailable or goes over my head.
All I would like to know is how to click on a thumbnail and load and unload the image using in and out fades. I have seen something which is almost what I need (both fade in and fade out are present) in the form of Kirupa’s XML gallery, but I wanted to make mine just the bare essentials and really simple (i.e., no carousel/sliding effects). I just noticed that there is no tutorial for something like this. Kirupa has two very, very good tutorials (the XML portfolio, which is very simple, and the XML gallery with the slide, which is quite advanced) but not an ‘in-between’ one, such as the one I’m trying to create. A lot of people have the same problem as me, and, maybe if anyone managed to solve it, it could become something that everyone could use. I’m also sending what I have done so far (images included). I tried to upload it using the ‘Upload File from a URL’ option, but it didn’t work, so I basically have no choice (due to file size) but to post the link here, for which I’m not sure whether I’ll get kicked off or not…:lol:
Here it is…
http://www.megafileupload.com/en/file/202464/portfolioTEST-zip
I have an empty movie clip (‘loader’) and three thumbnails (‘thumb1’, ‘thumb2’ and ‘thumb3’) on the stage.
My code:
this.onEnterFrame=function() {
if (loader._alpha <100) {
loader._alpha += 5;
} /else {
if (loader._alpha > 0) {
loader._alpha -= 5;
}
}/
}
thumb1.onRelease=function(){
loader.loadMovie(“images/001.jpg”);
loader._alpha=0;
}
thumb2.onRelease=function(){
loader.loadMovie(“images/002.jpg”);
loader._alpha=0;
}
thumb3.onRelease=function(){
loader.loadMovie(“images/003.jpg”);
loader._alpha=0;
}
Thanks in advance everyone!
P.S. Sorry for the long message:lol: