hi, i was wondering how i would go about modifying the photo gallery tutorial so that the images change every 5 seconds or so and not as a result of a button click.
it’s probably really easy… but could someone point me in the right direction?
hi, i was wondering how i would go about modifying the photo gallery tutorial so that the images change every 5 seconds or so and not as a result of a button click.
it’s probably really easy… but could someone point me in the right direction?
Use setInterval:
[AS]MovieClip.prototype.changePhoto = function(d) {
clearInterval(Interval)
// 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;
setInterval(changePhoto, 5000, 1)
};
Interval = setInterval(changePhoto,5000,1)[/AS]
^ That calls changePhoto every 5 seconds.
cool. thanks! i had just found “setInterval” a few minutes ago, so i’ll try this and see if it works (which i’m sure it does). thanks a ton!!
Voetsjoeba, I just saw you were from Ghent. I visited Chent a month or two ago. Very beautiful…
Thank you It’s a beautiful city indeed. Did you see the “Belfort” ?
the code provided by Voetsjoeba above doesn’t seem to work. it locks the computer up. Anyone else have any suggestions?
perfect! thanks kode!
[AS]MovieClip.prototype.changePhoto = function(d) {
clearInterval(Interval)
// 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;
**Interval = **setInterval(changePhoto, 5000, 1)
};
Interval = setInterval(changePhoto,5000,1)[/AS]
slaps forehead Why did I forgot that ? Could you check again please ? Just to see if it works now.
nope, still nothing Voetsjoeba…
Hmmn … well, it sure calls the function every five seconds, so the problem would be somewhere else. Anyways, nevermind.
Originally posted by ivanwright
perfect! thanks kode!
No problem, ivan.
:: Copyright KIRUPA 2024 //--