Hi all-
First time poster and real flash newbie. Trying to get my head around all of the variables, functions, etc. Anyway, I want to modify the Kirupa photo gallery AS <http://www.kirupa.com/developer/mx/photogallery.htm> to have my movie go to another movie or scene after the images have been viewed one time instead of playing through the array over and over. Printing out the AS and going through my references I am getting an understanding of what things are doing. I figure it would be some mix of the pindex and pArray.length but I’m not sure how. Any help is greatly appreciated.
Hi,
I haven’t read the tute but it looks to me that want to know when ‘pindex’ and ‘pArray.length’ are equal to trigger anything else
SHO
I know that I need a conditional statement to trigger the desired action when the index and array length are equal but I don’t know where or exactly how to put it into the existing action script. I have tried adding it to the button which advances the array +1 on each press but that doesn’t work.
My gut tells me it should go in this section:
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;
I really like this tutorial because the arrays let me easily change my galleries for different situation. Thanks in advance for any help.
Hi,
(I had a look at the tute);
I would do it like this:
[AS]
MovieClip.prototype.fadeOut = function() {
if (this.photo._alpha>this.fadeSpeed) {
this.photo._alpha -= this.fadeSpeed;
} else {
if(this.pIndex == this.pArray.length){
this.doSomething();
} else {
this.loadPhoto();
}
}
};
[/AS]
SHO
Thanks eki!
I’ll try it out asap.
U r welcome
I must be dense. I really appreciate your help to this point and I understand what the AS should be doing but I can not get what you suggested to work.
All I am trying to do is get the gallery to go back to my main navigation after the array has played through one time. Like you have shown and I figured when the array length = index.
I can’t get what you showed me to do anything. The array is just repeating, I have tried goto actions just to make something happen. I even tried creating another prototype (waaaay over my head right now but copy and paste is powerful) that would go to a named frame when called.
My only thought is that the pIndex is declared near the top of the action script with d of +1 or -1 added as a % of the array length. Is this why your AS mod is not working for me?
This is frustrating like trying to stuff an octopus in a jar. I understand what the code is doing, I just can’t make anything do what I’d like it to do. I really appreciate your time for a newbie. This forum has already helped me figure out many things.
Obviously this is one of my first projects. All I want to do is use three photogallerys
accessed from one navigation screen. I want to go back to the navigation at the end of each gallery.
Thanks in advance. Persistence has its rewards.
Hi,
Sorry mate,
It should be the length-1!!!
I.e. : an array of three items has got a maximun index of 2
SHO
Hello eki if you’re out there-
Thanks for the addendum.
I got your suggestion to work with a minor workaround. When I add the “-1” my array returns to the navigation like it should but it goes after the second-to-last image in the array. I got around this by adding a “blank” jpg. to my array.
Now I get the “how”, I’m just really curious about the “why”. If we had to tell the array length -1 to get it to read properly and now it reads the command one short of the array length, why doesn’t it just read the array.length without the -1 in the first place?
Thanks again for all of your help, I really appreciate it.
Mildly confused but generally persistent.