7 Replies Latest reply on Mar 20, 2007 6:49 PM by Newsgroup_User

    slideshow not working

    ajrobson
      I have the following code which i use to scroll through images and display text to go with them, i have two problems i need help with.
      1. the next button needs to be pressed twice before the first image chnages
      2 the previous button does not work it just removes the first image instead of showing image 21

      Below is the two method i use i have cut all the code out apart from the script to go back and forth.

        • 1. Re: slideshow not working
          Level 7
          for 2...i is allowed to go to zero. You don't need the test for i <=21
          because your next button should keep i below 22. You're only option is to
          subtract 1 here.

          so

          if i > 1 then
          i = i - 1
          else
          i = 21
          end if

          Likewise for the next button

          if i < 21 then
          i = i + 1
          else
          i = 1
          end if

          Typically, it's better to keep the more commonly met condition as the first
          condition so rather than test first for the limit in each case, I'm testing
          for the more common occurrance.

          Craig


          --
          Craig Wollman
          Lingo Specialist
          Word of Mouth Productions
          212-928-9581

          www.wordofmouthpros.com
          "ajrobson" <webforumsuser@macromedia.com> wrote in message
          news:etpi31$r5h$1@forums.macromedia.com...
          >I have the following code which i use to scroll through images and display
          >text
          > to go with them, i have two problems i need help with.
          > 1. the next button needs to be pressed twice before the first image
          > chnages
          > 2 the previous button does not work it just removes the first image
          > instead of
          > showing image 21
          >
          > Below is the two method i use i have cut all the code out apart from the
          > script to go back and forth.
          >
          >
          >
          > ---------previous
          > on mouseUp me
          > global i -- index to step through cast member numbers
          > if i<=21 then
          > i = i-1
          > else
          > i = 1 -- go back to beginning
          > end if
          > -- swap cast member
          > sprite(2).member = member(i, "posters")
          > sprite(2).height = 220
          > sprite(2).width = 300
          > sprite(6).member = member(i, "poster info")
          > end
          >
          > ------ next
          > on mouseUp me
          > global i -- index to step through cast member numbers
          > if i >=1 AND i<21 then
          > i = i+1
          > else
          > i = 1 -- go back to beginning
          > end if
          > -- swap cast member
          > sprite(2).member = member(i, "posters")
          > sprite(2).height = 220
          > sprite(2).width = 300
          > sprite(6).member = member(i, "poster info")
          > end
          >


          • 2. Re: slideshow not working
            Charles Parcell Level 1
            Try this
            • 3. Re: slideshow not working
              ajrobson Level 1
              thanks that seems to work in a way but for some reason if i start the movie then stop it and start again the posters are not in order they just seem to be in a random order, if the value of i being stored somewhere? is there a way to set i to 0 in my on moviestart script?
              • 4. Re: slideshow not working
                Level 7
                well, of course, global variables persist in authoring mode.

                Add this to a movie script

                global i

                on PrepareMovie
                i = 1
                end

                --
                Craig Wollman
                Lingo Specialist
                Word of Mouth Productions
                212-928-9581

                www.wordofmouthpros.com
                "ajrobson" <webforumsuser@macromedia.com> wrote in message
                news:etpmjp$3hg$1@forums.macromedia.com...
                > thanks that seems to work in a way but for some reason if i start the
                > movie
                > then stop it and start again the posters are not in order they just seem
                > to be
                > in a random order, if the value of i being stored somewhere? is there a
                > way to
                > set i to 0 in my on moviestart script?
                >


                • 5. Re: slideshow not working
                  Level 7
                  oops, to reference your post, use i = 0 instead of i = 1



                  --
                  Craig Wollman
                  Lingo Specialist
                  Word of Mouth Productions
                  212-928-9581

                  www.wordofmouthpros.com
                  "ajrobson" <webforumsuser@macromedia.com> wrote in message
                  news:etpmjp$3hg$1@forums.macromedia.com...
                  > thanks that seems to work in a way but for some reason if i start the
                  > movie
                  > then stop it and start again the posters are not in order they just seem
                  > to be
                  > in a random order, if the value of i being stored somewhere? is there a
                  > way to
                  > set i to 0 in my on moviestart script?
                  >


                  • 6. Re: slideshow not working
                    Charles Parcell Level 1
                    Try adding...
                    • 7. Re: slideshow not working
                      Level 7
                      It's always best to initialize variables, especially globals, rather than
                      starting with a value of VOID.


                      --
                      Craig Wollman
                      Lingo Specialist
                      Word of Mouth Productions
                      212-928-9581

                      www.wordofmouthpros.com
                      "ajrobson" <webforumsuser@macromedia.com> wrote in message
                      news:etpmjp$3hg$1@forums.macromedia.com...
                      > thanks that seems to work in a way but for some reason if i start the
                      > movie
                      > then stop it and start again the posters are not in order they just seem
                      > to be
                      > in a random order, if the value of i being stored somewhere? is there a
                      > way to
                      > set i to 0 in my on moviestart script?
                      >