Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 10 of 10
  1. #1
    Join Date
    Apr 2005
    Location
    Olympia, WA
    Posts
    26

    Change images on page using a button

    I'm working on my first AMS project. It's a multi-media textbook. I'm stumped figuring out how to use a button to display an image and then, when clicked, display another image. Need to click through as many as 6 images. Also need to have a button to click Back to the previous image. I'm an absolute novice with scripts.

    I've attached a screenshot and hope it shows well enough to help my lame description.

    I have a paragraph on the left side of the page. I have images on the right. I need to be able to use the arrow buttons below the image to move from one image to another -- Next image, Back to previous image. The text does not need to change with the images.

    Thanks!
    Craig
    Attached Images

  2. #2
    Join Date
    Aug 2003
    Posts
    2,427
    Hi,

    The action that you need in your button's On Click event is Image.Load e.g.

    Image.Load("Image1", "AutoPlay\\Images\\indigorose.png");

    There are a couple of different approaches to determining what the next image is. The elegant way is to first enumerate the contents of the images folder and then work through them on each click.

    Another way (the one I always use) is to have your images named sequentially i.e. 1.jpg, 2.jpg, 3.jpg etc. Then on each click, first increase a variable by 1 and use that to build the image name and then load it (note that you need to initialise the variable x before you use it i.e. in the page pre-load just put a statement x=0) - e.g. -

    x=x+1
    if x>5 then x=1 end
    pic="AutoPlay\\Images\\"..x..".jpg"
    Image.Load("Image1", pic);

    Same thing for the "previous button" except of course x=x-1 and if x<1 then x=5.

    Although you say you don't need to change the text, you can do that easily enough all on the click of your next and previous buttons.
    Last edited by longedge; 05-23-2005 at 02:10 AM.

  3. #3
    Join Date
    Sep 2002
    Location
    Sol 3
    Posts
    3,160
    Great solution longedge.

    I have used something similar in the past were I didn't want to rename all my pics I built a table containing all image names and used a script similar to what you posted to load the images in order of the table.

    Code:
    -- Define table of images in the order that they are to be displayed
    tbImages = {};
    tbImages[1] = "AutoPlay\\Images\\imagename.jpg";
    tbImages[2] = "AutoPlay\\Images\\magenamei.jpg";
    tbImages[3] = "AutoPlay\\Images\\agenameim.jpg";
    tbImages[4] = "AutoPlay\\Images\\genameima.jpg";
    tbImages[5] = "AutoPlay\\Images\\enameimag.jpg";
    tbImages[6] = "AutoPlay\\Images\\nameimage.jpg";
    tbImages[7] = "AutoPlay\\Images\\ameimagen.jpg";
    
    -- call the next and previous images 
    x=x+1;
    if x>Table.Count(tbImages) then x=1 end
    Image.Load(tbImages[x], pic);
    
    -- or
    x=x-1;
    if x<1 then x=Table.Count(tbImages) end
    Image.Load(tbImages[x], pic);
    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

  4. #4
    Join Date
    Apr 2005
    Location
    Olympia, WA
    Posts
    26
    Thank you longedge and TJ_Tigger. I'll get to working on this tonight. I can see I've got much to learn!
    Craig

  5. #5
    Join Date
    Jun 2001
    Location
    California
    Posts
    2,014
    Man can you imagine useing that Flash page turn on this?! Sweet.

    Nice job Craig.

  6. #6
    Join Date
    Feb 2004
    Location
    Cowfields of Germany
    Posts
    617

    quick

    Hey Tigg,

    A quick way to rename your images is to drag them all into Photoshop and use the Batch option under the FILE menu.

    Thanks for the certificate you built thats posted on WWW.AMSUSER.COM
    I changed it a little and added it to a training program I built.

    Chris

  7. #7
    Join Date
    Sep 2002
    Location
    Sol 3
    Posts
    3,160
    Quote Originally Posted by stickck
    Hey Tigg,

    A quick way to rename your images is to drag them all into Photoshop and use the Batch option under the FILE menu.

    Thanks for the certificate you built thats posted on WWW.AMSUSER.COM
    I changed it a little and added it to a training program I built.

    Chris

    I use CompuPic Pro from www.photodex.com to do batch changes to most of my photos. If that is the way you want to go it is easy to rename them for use in a function like that. I sometimes want to keep then named a particular way for my own purposes and references.

    Thanks for the pointer

    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

  8. #8
    Join Date
    Apr 2005
    Location
    Olympia, WA
    Posts
    26
    Bruce,
    Thanks for the flash page turn. I'll need to play with it. Uncharted territory for me. I had been wondering if there was a way to have a page turning transition. I'm guessing that is what the Flash page turn does.
    Craig

  9. #9
    Corey is offline Indigo Rose Staff Alumni
    Join Date
    Aug 2002
    Posts
    9,746
    Hmmm, seems to me someone created a page-turn add-on once but I can't remember what happened with that in the end. I remember seeing it once though, it was awesome.

  10. #10
    Join Date
    Aug 2003
    Posts
    2,427
    Quote Originally Posted by Corey
    Hmmm, seems to me someone created a page-turn add-on once but I can't remember what happened with that in the end. I remember seeing it once though, it was awesome.
    This is Ron territory - he's done some snazzy stuff along these lines along.
    Cue RHOSK :-

Similar Threads

  1. Example: Creating an on/off button to toggle background audio
    By Jonas DK in forum AutoPlay Media Studio 5.0 Examples
    Replies: 0
    Last Post: 07-10-2004, 02:54 PM
  2. Setting Page Transition Effects
    By Desmond in forum AutoPlay Media Studio 5.0 Examples
    Replies: 0
    Last Post: 09-24-2003, 01:08 PM
  3. Button Hiding Blues
    By Tezcatlipoca in forum AutoPlay Media Studio 4.0
    Replies: 5
    Last Post: 04-11-2003, 04:57 PM
  4. Reviewing multiple images on same page
    By mstumpo in forum AutoPlay Media Studio 4.0
    Replies: 8
    Last Post: 12-10-2002, 01:29 PM
  5. HOWTO: Create a Page Template
    By Support in forum AutoPlay Media Studio 4.0 Examples
    Replies: 0
    Last Post: 10-26-2002, 05:20 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts