View Full Version : photo gallery with scrollpane tutorial???
rita1608
02-02-2005, 05:17 AM
Hello everyone,
I am trying to create photo gallery that will load thumbnail in the scroll pane with the scroll box, and then pressing on each thumb will load the correspondent image on the main loading screen
I found a great example online http://www21.brinkster.com/cheefong/index.asp
but still can't make it work trying to attach the .swf file
i get the error "url can't be found" although it's there.
Ah also wanted to let you know that I am just newby in Flash , you wouldn't believe i spent weeks trying to figure it out and i am almost ready to give up :eek:
Anyone can help me fill my action script with right variables?
onClipEvent (load)
{
var n = 0;
class_lv = new LoadVars();
class_lv.onLoad = function ()
{
var class_name = new Array();
var class_id = new Array();
var i = 0;
while (i < this.number)
{
class_name = this.classname.split("|");
class_id = this.classid.split("|");
i++;
} // end while
var i = 0;
while (i < this.number)
{
_root.class_mc.addItem(class_name[i], class_id[i]);
i++;
} // end while
};
class_lv.load("coolfusion.asp", class_lv, "GET");
}
I will really appreciate if sombody could help me modify it for my pictures, so I can make my dream gallery work!!!undefinedundefined
Thanks for your time,
Sincerely,
Rita
rita1608
02-03-2005, 01:25 AM
hello Everyone,
I need some help with action scrip for scroll pane.
I am trying to do a photo gallery where the combobox will load a set of thumbnails on the scrollpane and then by clicking on each thumbnail will load the original image on the main loading screen.
Unfortunately, after several attemps I got so confused and no longer know whick way to go or where to start from. I am very new to action script
If anyone doesn't understand what I am trying to make ask me ad I will try to explain in in different way.
Is there anyone who know how to do it?
I will appreciate any help.
Thanks,
Rita
rita1608
02-03-2005, 11:12 PM
Hi,
I am trying tofigure out simple flash gallery
I have 5 thumbnails on the stage and they are supposed to load the corresponding image for each of them.
The thumbnails loaded on the screen fine but my big images just dont show
up
Could anyone tell me what I am doing wrong?
Thanks in advance
Rita
Here's my code:
image_arr = new Array("image1", "image2", "image3", "image4", "image5");
currentHolder = 0;
theDepth = 1000;
_global.imageLoaded = false;
_global.selectedImage = 0;
this.createEmptyMovieClip("img1_mc", theDepth++ + 10000);
this.createEmptyMovieClip("img2_mc", theDepth++ + 10000);
for (var i = 0 ; i < image_arr.length ; i++)
{
this.createEmptyMovieClip("thumb" + i + "_mc", theDepth++);
this["thumb" + i + "_mc"]._x = 50;
this["thumb" + i + "_mc"]._y = -110 + 120* i;
this["thumb" + i + "_mc"].loadMovie(image_arr[i] + "_tn.jpg");
}
this["thumb" + i + "_tmp_mc"].no = i;
this["thumb" + i + "_tmp_mc"].onEnterFrame = function()
{
var l = this._parent["thumb" + this.no + "_mc"].getBytesLoaded();
var t = this._parent["thumb" + this.no + "_mc"].getBytesTotal();
if ((l >= t) && (t > 1) && (this._parent["thumb" + this.no + "_mc"]._width > 1))
{
this._parent["thumb" + this.no + "_mc"].num = this.no;
this._parent["thumb" + this.no + "_mc"].onPress = function()
{
if ((_global.selectedImage != this.num) && (_global.imageLoaded))
{
loadImage(this.num);
}
};
delete this.onEnterFrame;
this.removeMovieClip();
}
};
function loadImage(num)
{
_global.imageLoaded = false;
this["img" + currentHolder + "_mc"]._x = 1000;
this["img" + currentHolder + "_mc"]._y = 221.0;
this.createEmptyMovieClip("img1_tmp_mc", theDepth++);
this.createEmptyMovieClip("img2_tmp_mc", theDepth++);
this["img" + currentHolder + "_mc"].loadMovie(image_arr[num] + ".jpg");
this["img" + currentHolder + "_tmp_mc"].onEnterFrame = function()
{
var l = this._parent["img" + currentHolder + "_mc"].getBytesLoaded();
var t = this._parent["img" + currentHolder + "_mc"].getBytesTotal();
if ((l >= t) && (t > 1) && (this._parent["img" + currentHolder + "_mc"]._width > 1))
{
this._parent["img" + currentHolder + "_mc"]._alpha = 1;
this._parent["img" + currentHolder + "_mc"]._y = -110;
_global.imageLoaded = true;
_global.selectedImage = num;
delete this.onEnterFrame;
this.removeMovieClip();
}
};
this["img" + ((currentHolder + 1) % 2) + "_tmp_mc"].onEnterFrame = function()
{
if (_global.imageLoaded)
{
if (this._parent["img" + currentHolder + "_mc"]._alpha < 100)
{
this._parent["img" + currentHolder + "_mc"]._alpha += 5;
this._parent["img" + ((currentHolder + 1) % 2) + "_mc"]._alpha -= 20;
}
else
{
this._parent["img" + currentHolder + "_mc"]._alpha = 100;
this._parent["img" + ((currentHolder + 1) % 2) + "_mc"]._alpha = 0;
currentHolder = (currentHolder + 1) % 2;
delete this.onEnterFrame;
this.removeMovieClip();
}
}
};
}
loadImage(_global.selectedImage);
CyanBlue
02-04-2005, 12:15 AM
Howdy and Welcome... :)
Hm... The code look very familiar... :D
Check this page out and make sure you are not missing anything... :)
http://tutorials.flashvacuum.com/article.php?article=12
rita1608
02-04-2005, 12:52 AM
Dear CyanBlue/or any forummates
Yes, I was using your tutorial, you are right. Thank you so much for writing it it's just what I was looking for...
But since I am just trying to learn action script I think I made a mistake doing different modification of the script you provided. I have 5 pictures and the size of thumbnails is different from yours : my thumbs are 62X113 and original images 242X242, I changed the position of thumbs and they loaded fine on the stage, but I can't seem to load the big images, neither of them even the first one that should load automatically,
Could you please tell me what is my mistake.
I am trying to learn and see how it works.
But i definetely stuck this time....
I will appreciate any help.
Thank you,
Rita
CyanBlue
02-04-2005, 01:18 AM
Uh... You are not really fixing anything just by chaning the movieClip names... I had my reasons why I named the movieClips img0_mc and img1_mc and so on... Go get the script from the original file and just change the image file names to what I have in the tutorial... Once you get that working, start playing with what you have in your posession... If you don't understand what you have, you should start reading it again... :)
rita1608
02-04-2005, 03:03 AM
Dear CyanBlue,
thanks so much for your recommendation.
Could you please tell me what should i do if i want to put more thumbnails and add them to the scroll pane.?
What do I need to add to the script to make it work?
Thank you so much,
Rita
CyanBlue
02-04-2005, 04:24 AM
Hi... :)
I don't want to be rude or anything, but the only reason why people writes tutorials is because they want you learn something... and it looks like you just want to find something that you can use to suit your need without actually learning anything... :(
I've done what I could to help you understand what part of the script does what and whatnots... I'll be happy to help you if you have any question... But don't start to jump to your final version until you understand the basic things...
At any rate...
To add more pictures... All you need to do is to add the file names into the image_arr array...
To put the thumbnails into the scrollPane component... You need to move the thumbnails into another movieClip and have scrollPane hold that movieClip that contains multiple thumbnail movieClips... :)
rita1608
02-04-2005, 04:34 AM
Dear CyanBlue,
The least I want is to find what just suite my needs,(of course I still want it)
I do want to learn things and thanks for your hints with images names. they did work for me fine.
Right now I am planning to figure out how to make combobox, scroll pane and my thumbnails work as a gallery all together...
I do want to learn,and I spent days and nights trying to understand the principles of flash, I was completely new to it... I just needed someone like you to help me go in ther right direction.
Thank you so much,
I am going to try and make it work
Thanks again,
Rita
CyanBlue
02-04-2005, 05:15 AM
BTW... What did you mean by the comboBox??? What is that used for???
Maybe you are looking for the gallery like this??? I used this one alot for my projects cuz it's good component... ;)
http://www.mr10.net/
rita1608
02-04-2005, 05:44 AM
Yes, CyanBlue
I am looking for something similar, but I am going to have a combobox that will have 6 labels and on pressing a label a movie clip with thumbs will load into scrolling pane and then I will assign the action to each of the thums to load the original size image, just like you taught us in your 101 gallery :)
It;s kind of hard for me but I am working on it and I want to hope I could make it work,
So, please don't think i don't want to learn, I want it very much,,,
Ok going back to learning process, ugh....
Thanks,
Rita
rita1608
02-05-2005, 07:22 AM
Does anyone know about a tutorial of photogallery in flash in scrollpane and combobox component?
if so, Could you please direct me to it?
Thanks,
Rita
CyanBlue
02-06-2005, 05:37 AM
http://www.actionscript.org/forums/showthread.php3?t=64316
vBulletin® v3.7.1, Copyright ©2000-2009, Jelsoft Enterprises Ltd.