Hey all, been Working on my new website, and trying to get a dynamic Photo gallery working, I got it working fine for one section, But say i had 4 other section with different images in each section, How would i go around to do this, setting up a array for each section? Any help will be great.
bump;)
well, it really depends on how you set up the gallery…
but i guess you could use a multidimensional array. =)
just a simple gallery, basically it’s for the portfolio section. you click what type of work (print, 3d, web) then from that you select a product. now that is where i 'm placing the gallery. If there are 4 products to choose from, each with 4 or more images
So what do you think i should do?
yup… i’d use a multidimensional array.
gallery = [["1.jpg", "2.jpg"], ["1.jpg", "2.jpg"], ["1.jpg", "2.jpg"], ["1.jpg", "2.jpg"]];
you’ll need to define a variable when the product is selected. let’s say the first product is selected, you’d have something like this:
product1.onRelease = function() {
_global.subgallery = 0;
};
then load each jpg with:
someMovieClip.loadMovie(gallery[subgallery][pic]);
pic would be another variable to select the actual image to load. =)
kool, i’ll give it a go,thanx mate
ok. =)
let me know if you have any problems.
havent got flash in front of me at the moment, but from the code how does it detect which array is to be used?
with the variable subgallery…
if the first product is selected: _global.subgallery = 0;
if the second product is selected: _global.subgallery = 1;
if the third product is selected: _global.subgallery = 2;
if the fourth product is selected: _global.subgallery = 3;
got it?
lol, i just realised that while you posted, kool, be home later tonight to try the code.
kax , would you be able to make a quick fla, dont worry about the images. I’m kinda lost here, would be greatly appreciated.
ok… hope this get you started. =)
you’d only need to replace that stupid setText function with a loadMovie action…
ps. don’t expect anything fancy… it’s 4:30 am.
lol, thanks dude
I’ll bug you another day, get some rest
get some rest… ?
yeah… i will (… eventually).
hey , got your txt verison workin, going to try the jpg soon, though a little problem. Due to my layout, my menu for selecting the products are in its own movie clip.
_root.menu.scrolly.buttons
Now i have found that even if i have made a path to the button in the actionscript
_root.menu.scrolly.buttons.subgallery2.onRelease = function() {
_global.subgallery = 1;
_global.index = 0;
setText();
It dosent work, i made a dummy button on the main timeline and that button worked. Are there issues with nested Movieclips(movieclips as buttons) or might my paths be wrong? ive checked them again and again, i see no errors?
yeah… it could be the addressing. :-\
try targetting the MovieClip containing the TextField.
_root.menu.scrolly.buttons.subgallery2.onRelease = function() {
_global.subgallery = 1;
_global.index = 0;
_root.someMovieClip.setText();
};
// or if the TextField is in the _root
_root.menu.scrolly.buttons.subgallery2.onRelease = function() {
_global.subgallery = 1;
_global.index = 0;
_root.setText();
};
hmmm, still not working, ill keep trying at it.
::btw i added your buttons (in your example) in about 3 nested Mc’s and it worked fine, so there might be something wrong with my addressing or layout.
I’ll keep you posted.
thanks again
ok… good luck, soulty.
Hey kax more problems.
First i will say that the code is on the main timeline of a external movie allocated at frame 62 where there is a stop action on top of it.
The Swf is a external movie that is getting loaded into a target mc called content.
I just need to run this by you tto see if this code i’m using is right so i can narrow down what the problem could be.
_global.setText = function() {
currentImage.text = gallery[subgallery][index];
};
_global.subgallery=0, _global.index=0;
gallery = [["subgallery1 - pic1", "subgallery1 - pic2"], ["subgallery2 - pic1", "subgallery2 - pic2", "subgallery2 - pic3", "subgallery2 - pic4"]];
_root.content.test.sub1.onRelease = function() {
_global.subgallery = 0;
_global.index = 0;
this.setText();
};
_root.content.test.sub2.onRelease = function() {
_global.subgallery = 1;
_global.index = 0;
this.setText();
};
_root.content.test.sub3.onRelease = function() {
_global.subgallery = 2;
_global.index = 0;
this.setText();
};
_root.content.test.sub4.onRelease = function() {
_global.subgallery = 3;
_global.index = 0;
this.setText();
};
prevPic.onRelease = function() {
_global.index>0 ? _global.index-- : _global.index=gallery[subgallery].length-1;
this.setText();
};
nextPic.onRelease = function() {
_global.index<gallery[subgallery].length-1 ? _global.index++ : _global.index=0;
this.setText();
};
::: btw made the array shorter because it was making the thread really wide in width.
Can u see anything wrong?
talk soon.
Soulty
thanks
_root.content.test.sub1.onRelease = function() {
_global.subgallery = 0;
_global.index = 0;
**this.setText();**
};
there must be the problem. try removing this.