1 Reply Latest reply on Jul 12, 2006 12:13 AM by blemmo

    Loading Pictures with AS

    Sw Jiten Level 1
      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,
        • 1. Re: Loading Pictures with AS
          blemmo Level 1
          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