Photo Gallery - Please Help!

Regarding the Photo Gallery tutorial…

I’ve used it, and it works just fine…
But…I don’t want to use buttons…or key presses (like at the end of the code)
I want a continuos loop…through all my pictures.

How do I do that?
Please Help…I need this yesterday!:sure:

Thanks

Here’s the current code.
[AS]
//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 = [“BO1.jpg”, “GeGe2.jpg”, “HEATHER3.jpg”, “JAMES4.jpg”, “JEN5.jpg”, “KENNIE6.jpg”, “MEL7.jpg”, “Nicole8.jpg”, “TAMMY9.jpg”, “TOM10.jpg”];
this.fadeSpeed = 10;
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);
[/AS]

aChange = function(i) {
i.changePhoto(1);
};
setInterval(aChange, milliseconds, this);

just change milliseconds to the time you want :wink: =)

me again… :stuck_out_tongue:

now that i think about it, you don’t need that code.

setInterval(this, "changePhoto", milliseconds, 1);

would do… :sigh:

Thanks for the help!

Worked great!

Although it worked fine with your first post…didn’t try the second suggestion:sigh:
…what’s the difference?

Also, If I wanted to make each image a button, to where …when clicked…it would load a .swf …like a bio or something…any suggestions?

Again Thanks!!!

there’s no real difference between them… less coding. that’s all :wink:

and i didn’t test this… but i think you’d need to assign the even handler in this prototype

MovieClip.prototype.fadeIn = function() {
if (this.photo._alpha<100-this.fadeSpeed) {
this.photo._alpha += this.fadeSpeed;
} else {
this.photo._alpha = 100;
this.onEnterFrame = null;
this.photo.onRelease = function() {
statement(s);
}
}
}

=)

KAX…
Thanks for all your help…

I having fits with the button thingy.

Basically, I’ve created one button…with just a “hit” action so it’s invisible.
It’s on a layer above my photos.

Is there a way…to load a seperate movie on the click of the button…based on what photo is showing?

This is driving me nuts!

Thanks in advance.

i guess you can store the name of the movies in an array. then use the variable pIndex to load the content… =)

something like this:

movies = ["BO1.swf", "GeGe2.swf", "HEATHER3.swf"];
myButton.onRelease = function() {
myMovieClip.loadMovie(movies[pIndex]);
}

:wink:

I’m trying to do the same thing…
And I’m getting these errors:

[AS]
Scene=Scene 1, Layer=Layer 25, Frame=1: Line 1: Statement must appear within on handler
movies = [“bo1.swf”, “gege2.swf”, “heather3.swf”, “james4.swf”, “jen5.swf”, “kennie6.swf”, “mel7.swf”, “nicole8.swf”, “tammy9.swf”, “tom10.swf”];

Scene=Scene 1, Layer=Layer 25, Frame=1: Line 2: Statement must appear within on handler
myButton.onRelease = function() {[/AS]

Any help???

put the script in the timeline… not in the button actions :wink: =)

hmmm…I’m trying to load the .swf into a emtpy movie clip on the stage…

I moved the code to the timeline…but nothing happens…no errors…nothing.

sorry for all the questions…but how does it know “which” button I’ve pressed? and where is it stated in the “AS” to load the movie into a movie clip?

*I"m confused…as usual *:smirk:

but how does it know “which” button I’ve pressed?

myButton is the instance name of the button. of course you can change it to whatever you want.
if the instance name of your button is abc… then replace myButton with abc

where is it stated in the “AS” to load the movie into a movie clip?

myMovieClip.loadMovie(movies[pIndex]);

again… replace myMovieClip with the instance name of your movie clip.

Kax…you are the greatest!

That works great!

thanks for the help man…I really appreciate it.

:beam:

:stuck_out_tongue:

no problem =)