Hello all,
I’ve gone through the XML and Flash PhotoGallery tutorial but am having some trouble adopting something. I’d like to figure out a way to randomly choose something from the XML array and load that image after 10 seconds. I’ve looked all over but can’t find what I am looking for.
Here are the two functions. I am having problems incorporating the two.
Array.prototype.randomize = function() {
for (var j=this.length-1; j>0; j–) {
var pick = random(j);
var tmp = this[pick];
this[pick] = this[j];
this[j] = tmp;
}
};
function firstImage() {
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[0], 1);
}
}
So it seems I want the image to load a varaible that equals a random number pulled from the array ‘total’ which is derived from orginal xmlLoad code. Say, ‘r’.
picture.loadMovie(image[r], 1);
I have messed around with variations of creating r my calling the randomize function but with no luck. What am I doing wrong?
Needless to say, I am not very good at AS.
OK, my other problem is then incorporating the timing portion. Is it just embedding the firstImage function in a loop of something? Again, feel free to just point me to a good toturial I can mess with. Once I’m on the right trail I can usually figure things out.
Thanks!
-Patrick