Skip to main content
July 12, 2006
Question

Loading Pictures with AS

  • July 12, 2006
  • 1 reply
  • 177 views
I am creating a picture loader, using thumbnails, but I would like that: on the first moment, as soon as the page appears, one of the pictures, be Displayed. (choosen by random process). How do I do it ? To be more specific, there is the Site (not finished by now): http://www.paolamarsano.com

Thanx,
This topic has been closed for replies.

1 reply

Inspiring
July 12, 2006
You could call the event assigned to the thumbnails on load. I suppose you already have the script for loading the pic, now you just need to call that. How to choose a picture randomly depends on your setup: if the pictures are named with increasing numbers, you could get a random number and just add it to the name, like this:
--
var rand:Number = Math.floor(Math.random() * picturecount);
var picUrl:String = "image"+rand+".jpg";
// load it
--
If they have other names, you could put the names in an array, get a random number like above, and load the array entry at that number.

hth,
blemmo