Change images using a button – Again!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • CraigS
    Indigo Rose Customer
    • Apr 2005
    • 26

    Change images using a button – Again!

    First, thank you to all. This forum is a great help for me and the humor and friendliness are energizing!
    After taking some time for family matters and studying some scripting I’m finally back to working on my first project, a textbook. This is a continuation of a question I posted on May 23 http://www.indigorose.com/forums/showthread.php?t=11524 My thanks to Lonedge and TJ Tigger for helping me then!

    I need to be able to click buttons -- “previous” and “next” -- to change pictures on a page, one picture replacing the next, positioned in the correct location. There is paragraph object on the left side and pictures on the right side of each page. The paragraph will remain the same; only pictures will need to change, replacing one another. I have a “container” object on the right side to hold the pictures. Pages will need to load with the first picture already in place. I’m hoping that by using Image.SetSize with a “container” I’ll be able to place pictures correctly. But I’ll tackle that next, with help from y’all I’m certain!

    On March 25 Jack Sparrow posted this thread to which Longedge replied: http://www.indigorose.com/forums/showthread.php?t=10887.
    Longedge included an attachment called Pictures.apz. I’m plagiarizing the script from Longedge’s Pictures.apz but I can’t get it to work for me. And I’m baffled…but not buffaloed! Here is the script I’m using. Thanks Longedge! (I’m not attempting the Image.SetSize yet).

    OnPreload
    -- Check if this is the first time the page has loaded.
    -- If it is then the variable picset will be null so we'll set it to 1
    -- We don't need the 'else' really but it completes the logic.
    if pic_no==nil then pic_no = 1 end
    pic = "AutoPlay\\Images\\Ears\\eaalert"..pic_no..".j pg"
    Image.Load("eaalert2", pic);

    OnClick
    -- Increment the number by 1 then check if it's more than 4
    -- if so then reset it to 1
    pic_no = pic_no + 1
    if pic_no > 3 then pic_no = 1 end
    -- Build the name of the picture to load
    -- then load it.
    pic = "AutoPlay\\Images\\Ears\\eaalert"..pic_no..".j pg"
    Image.Load("eaalert2", pic);

    Thank you and Happy Independence Day!
    Craig
    Last edited by CraigS; 07-04-2005, 02:57 PM. Reason: Deleted attachment that didn't upload properly
  • Intrigued
    Indigo Rose Customer
    • Dec 2003
    • 6138

    #2
    recant my thoughts...
    Intrigued

    Comment

    • CraigS
      Indigo Rose Customer
      • Apr 2005
      • 26

      #3
      I'm confused

      I'm really stuck trying to figure out the script to use. I got your reply Intrigued via email that had your post of adding ; but the reply on the forum is different. Also ; didn't make a difference, plus the script on Longedges example I referred to works on his attachment without the ;.
      Craig
      Last edited by CraigS; 07-05-2005, 10:27 PM.

      Comment

      • Intrigued
        Indigo Rose Customer
        • Dec 2003
        • 6138

        #4
        Originally posted by CraigS
        I'm really stuck trying to figure out the script to use. I got your reply Intrigued via email that had your post of adding ; but the reply on the forum is different. Also ; didn't make a difference, plus the script on Longedges example I referred to works on his attachment without the ;.
        Craig
        Ya, the ";" is not needed. (I typed before I double-checked, but I caught it a tad late still I see )
        Intrigued

        Comment

        • CraigS
          Indigo Rose Customer
          • Apr 2005
          • 26

          #5
          Thank you Intrigued. I thought I was losing it given the challenge I'm having figuring out this scripting.
          Attached is a screenshot of a the page I'm trying to set up so I can click through pictures with each one replacing the other and each being properly placed on the left side. Some are portrait and some landscape. I've sized them all so they can fit in the alotted space.
          Do you or anyone else have any ideas on how to get this to work? I'm so green at scripting, I'm a bit over come!
          Craig
          Attached Files
          Last edited by CraigS; 07-05-2005, 11:18 PM. Reason: Had to reload the attachment

          Comment

          • Intrigued
            Indigo Rose Customer
            • Dec 2003
            • 6138

            #6
            Craig, if no one helps you soon.. I'll be back to help tomorrow (Wednesday for me). It's late my way and I really need to bugger off to bed.
            Intrigued

            Comment

            • Dermot
              Indigo Rose Customer
              • Apr 2004
              • 1791

              #7
              Hi Craig

              What's not working? Do you get an error or are the images not displaying. If you have your images named correctly (eaalert1.jpg, eaalert2.jpg etc.) and they are in the correct folder then the code you have should work.

              If your file names and folder structure are correct and it is still not displaying the images try adding the _SourceFolder variable like below:

              pic = _SourceFolder.."\\AutoPlay\\Images\\Ears\\eaalert" ..pic_no..".jpg"

              I have found this solved problems for me in the past.

              Dermot
              Dermot

              I am so out of here :yes

              Comment

              • longedge
                Indigo Rose Customer
                • Aug 2003
                • 2498

                #8
                Originally posted by Intrigued
                Craig, if no one helps you soon.. I'll be back to help tomorrow (Wednesday for me). It's late my way and I really need to bugger off to bed.
                ...and early my way - just got up and off to work but having a very quick look in before I leave (while eating my cornflakes).

                I'm sure you'll get this fixed in no time Craig. I'll be back this evening - (my way)

                Comment

                • longedge
                  Indigo Rose Customer
                  • Aug 2003
                  • 2498

                  #9
                  just looked again - not sure but this line might be the cause -

                  Image.Load("eaalert2", pic);

                  by default your image object would be called Image1 so try -

                  Image.Load("Image1", pic);


                  Hi Ho Hi Ho it's off to work..........

                  Comment

                  • CraigS
                    Indigo Rose Customer
                    • Apr 2005
                    • 26

                    #10
                    Thank you all. I'm at work right now and will work on it more tonight when I get home.
                    Craig

                    Comment

                    • CraigS
                      Indigo Rose Customer
                      • Apr 2005
                      • 26

                      #11
                      I'm having a heck of a difficult time and feeling like a dunce! I just know this is going to turn out to be an obvious fix.

                      But now I'm trying trying to upload my project files so folks can look and see everything, including whether my file names and folder sturcture are correct. However, all I can attach is the .am5 project but it doesn't show the image files. I see that others have uploaded a .apz file that carries all the files for their project. How do I upload my project so the files are included? How do the files that folks have attached get the .apz extention, as with Longedge's Pictures.apz - from which I am taking the script and trying to adapt it to my project?

                      I did try using the _SourceFolder variable suggested by Dermot but no luck.

                      My file naming should be correct but I'd like to upload the project files for inspection.

                      I have attached what I could in hopes it helps

                      I gotta get some shuteye!
                      Thanks!
                      Craig
                      Attached Files

                      Comment

                      • Corey
                        Indigo Rose Staff Alumni
                        • Aug 2002
                        • 9745

                        #12
                        Hi Craig, to upload complete files use FILE > EXPORT, you should have an .apz file then as opposed to the .am5 file. :yes

                        Comment

                        • CraigS
                          Indigo Rose Customer
                          • Apr 2005
                          • 26

                          #13
                          Thank you Corey. I'm posting from work so will have to wait until this evening to upload the file. Hopefully at that point, with help, this can get figured out.
                          Craig

                          Comment

                          • CraigS
                            Indigo Rose Customer
                            • Apr 2005
                            • 26

                            #14
                            Thank you Corey, I've attached the .apz project file showing one page where I'm trying to replace the image it loads with by clicking the "next" button thus loading a new picture. The pictures that are supposed to load are eaalert2.jpg and eaalert3.jpg. The script I'm using is modified from Longedge's Pictures.apz as noted above.
                            Are my file names and structure correct? Why isn't the "next" button working?
                            Craig
                            Attached Files

                            Comment

                            • Dermot
                              Indigo Rose Customer
                              • Apr 2004
                              • 1791

                              #15
                              Ok there were two things wrong one of which Longedge mention.

                              just looked again - not sure but this line might be the cause -

                              Image.Load("eaalert2", pic);

                              by default your image object would be called Image1 so try -

                              Image.Load("Image1", pic);
                              Your image object was named "Image1' but you were referring to it as something else.

                              The second problem was what I had mentioned before and that was the folder structure. Your images were one folder deeper than you had in the code. Youa had "ears' as the folder the images were in but they were in another folder named "eaalert" which was in the "ears" folder.

                              I have fixed it up and attached the apz file. I also added the code to the previous button.

                              Dermot
                              Last edited by Dermot; 11-14-2009, 09:35 PM.
                              Dermot

                              I am so out of here :yes

                              Comment

                              Working...
                              X