Random image display stop on key...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • paulelvins
    Forum Member
    • Dec 2004
    • 3

    Random image display stop on key...

    Hey there...

    I need to create (very quickly) a random image displayer(?) of around 80 photographs of people.

    These photographs should be displayed for around .5 seconds each.

    Upon keypress / mouse down, the display should stop on the current image.

    I need some help... anyone??

    Cheers, Paul
  • longedge
    Indigo Rose Customer
    • Aug 2003
    • 2496

    #2
    Hello Paul,

    First of all I take it you've got AMS5 Pro Version which will allow to create random numbers.

    I would use IrfanView and resize all my pictures to the same dimensions and orientation then rename them image1.png through to image80.png.

    Insert an image object on your page with image1.png already loaded.

    In the pages On Show event do a Page.StartTimer(5000) for e.g. a 5 second display and then in the On Timer event enter use something like -

    x = Math.Random(1, 80);
    nextimage="AutoPlay\\Images\\image."..x.."png"
    Image.Load("Image1", nextimage);

    which will generate a number then build the number into a string to identify the image to load and load it.

    Some of the more capable members of the forum would probably write code to enumerate the image names and use them directly without the first steps but this is just one possibility which is quick and easy.

    Comment

    • TJ_Tigger
      Indigo Rose Customer
      • Sep 2002
      • 3159

      #3
      Originally posted by paulelvins
      Hey there...

      I need to create (very quickly) a random image displayer(?) of around 80 photographs of people.

      These photographs should be displayed for around .5 seconds each.

      Upon keypress / mouse down, the display should stop on the current image.

      I need some help... anyone??

      Cheers, Paul
      There are a few ways you can do this. If you don't want to rename your images I would suggest you use the File.Find to build a table of all your images. Those images will then be indexed numerically. Then you could use the Math.Seed/Math.Random to generate a random number between 1 and the Table.Count of the table containing your images. and then load that table[random] into your image object.

      As loneedge said, use the timer to change your images every .5 seconds. Then on keypress/mouse stop the timer.

      HTH
      Tigg
      TJ-Tigger
      "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
      "Draco dormiens nunquam titillandus."
      Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

      Comment

      • paulelvins
        Forum Member
        • Dec 2004
        • 3

        #4
        Thanks guys, but I can't seem to get it working.

        I've done exactly as longedge suggested but it doesn't seem to work, just stays on the first picture.

        Am I doing something wrong?... yep AMS5 PRO version being used.

        Cheers

        Paul

        Comment

        • paulelvins
          Forum Member
          • Dec 2004
          • 3

          #5
          Sorry guys... it was me!

          Working brilliantly now... thanks for your help

          Paul

          Comment

          Working...
          X