15 Replies Latest reply on Dec 21, 2006 5:46 AM by James Newton, ACP

    some help with basic mathematic function

    Level 7

      Hello:
      I am scrolling an image with 15 little images in it (20 pixels witdh each
      image).
      I want to show in a frame each image when I push a button. The image must
      scroll 20 pixels plus speed, the problem is that when I add the speed never
      match in its position alwasy some pixels more or less is.
      Can you hep me please?
      thanks in advance


        • 1. Re: some help with basic mathematic function
          Level 7
          Can you show us the code you have so far?
          • 2. Re: some help with basic mathematic function
            Level 7
            Thank you:
            I send you a piece of code (left button) of scroll image.


            property my
            property pCentralH --always show each slide in this position
            property pSpeed
            global gMove
            global gNumSlide
            global gTotalSlide
            property pDirection
            global gDirection
            global gHowSlidesMove

            on beginSprite me
            my = sprite(3)
            pCentralH = my.locH
            pSpeed=3
            gTotalSlide=37
            gHowSlidesMove=1
            end

            on exitFrame me
            if gMove then
            MoveSlide me , gHowSlidesMove, gDirection
            end if
            go to the frame
            end

            On MoveSlide me, NumSlides, direc
            ---------------ok------------------
            case direc of
            "LEFT": --left button
            if my.loch<= pCentralH -((abs(NumSlides-gNumSlide)-1)*20) then
            my.locH = my.locH + pSpeed
            else
            --1 slide less
            gNumSlide=gNumSlide-NumSlides
            member("TxtNumSlide").text=gNumSlide& " de" && gTotalSlides
            gMove=false
            end if
            --NUEVO
            sprite(10).member=member("m"& gNumSlide)
            UpdateStage
            "DCHA": --right button
            ....

            end case

            end


            • 3. Re: some help with basic mathematic function
              Level 7
              I'll take a look at this and get back to you tomorrow. I'm wasted tired
              right now, and I haven't finished my own work yet. Shouldn't be to hard
              of a problem to fix, though.
              • 4. Re: some help with basic mathematic function
                Level 7
                Thank You:
                I was trying to simplify the problem and I think this new code is better.
                Please, take a look when you can

                -- Welcome to Director --
                global gNumSlide
                global gTotalSlides
                global gDirection
                global gHowSlidesMove

                on beginSprite me
                my = sprite(3)
                pCentralH = my.locH
                pSpeed=5
                gTotalSlides=37
                gHowSlidesMove=1
                gDirection="LEFT"
                gNumSlide=1
                end

                on exitFrame me
                if gMove then
                MoveSlide me , gHowSlidesMove, gDirection
                end if
                go to the frame
                end

                On MoveSlide me, NumSlides, direc
                case direc of
                "RIGHT": --show slides
                if my.loch>= pCentralH -((abs(NumSlides-gNumSlide)-1)*70)-2 then
                my.locH = my.locH - pSpeed
                put (pCentralH -((abs(NumSlides-gNumSlide)-1)*70)-2 mod 70)
                else
                --1 slide less
                gNumSlide=gNumSlide+NumSlides
                member("TxtNumSlide").text=gNumSlide& " de" && gTotalSlides
                gMove=false
                end if
                --NUEVO
                sprite(10).member=member("m"& gNumSlide)
                UpdateStage
                "DCHA": --right button
                -- ....

                end case

                end

                "Word One - Denver" <wordonedenver@comcast.net> escribió en el mensaje
                news:elqkvf$qk9$1@forums.macromedia.com...
                > I'll take a look at this and get back to you tomorrow. I'm wasted tired
                > right now, and I haven't finished my own work yet. Shouldn't be to hard
                > of a problem to fix, though.


                • 5. Re: some help with basic mathematic function
                  Level 7
                  Just to make sure what you're doing here ...

                  The script you show is attached to the images you're moving, right. And
                  you have a button that, when pressed, sets gMove to true and activates
                  this code? Do you press the button and release, and the movement
                  continues until the image is in the right place? Or do you press and
                  hold the button and the image moves as long as the button is pressed?
                  Are there 37 separate images, or are there 27 pictures strung together
                  in one image?
                  • 6. Re: some help with basic mathematic function
                    James Newton, ACP Level 3
                    I've modified your code (see below). You say that there are 15 images, so I have set gTotalSlides to 15.

                    Here's how the code works: it scrolls the main image 5 pixels per frame, but every 20th pixel it sets a property called pFramesLeft to 0. If pFramesLeft is 0, then the one of the slides coincides with the frame. If gMove is set to FALSE when pFramesLeft is not 0, then the exitFrame handler will continue to call MoveSlide until pFramesLeft is 0. In other words, the main image will continue to scroll until the next slide coincides with the frame.

                    I've moved the calculations of the maximum and minimum values for my.locH to the beginSprite handler, so that fewer dynamic calculations are required.

                    gSlide gets updated only when a slide coincides with the frame.

                    Is this the sort of thing you are looking for?

                    • 7. Re: some help with basic mathematic function
                      Level 7
                      Many thanks:
                      I'll try it and tell you
                      Thanks again

                      "openspark" <webforumsuser@macromedia.com> escribió en el mensaje
                      news:elt1u2$nuf$1@forums.macromedia.com...
                      > I've modified your code (see below). You say that there are 15 images, so
                      > I
                      > have set gTotalSlides to 15.
                      >
                      > Here's how the code works: it scrolls the main image 5 pixels per frame,
                      > but
                      > every 20th pixel it sets a property called pFramesLeft to 0. If
                      > pFramesLeft is
                      > 0, then the one of the slides coincides with the frame. If gMove is set
                      > to
                      > FALSE when pFramesLeft is not 0, then the exitFrame handler will continue
                      > to
                      > call MoveSlide until pFramesLeft is 0. In other words, the main image
                      > will
                      > continue to scroll until the next slide coincides with the frame.
                      >
                      > I've moved the calculations of the maximum and minimum values for my.locH
                      > to
                      > the beginSprite handler, so that fewer dynamic calculations are required.
                      >
                      > gSlide gets updated only when a slide coincides with the frame.
                      >
                      > Is this the sort of thing you are looking for?
                      >
                      >
                      >
                      > -- Hello:
                      > -- I am scrolling an image with 15 little images in it (20 pixels witdh
                      > each
                      > image).
                      > -- I want to show in a frame each image when I push a button. The image
                      > must
                      > scroll 20 pixels plus speed,
                      > -- the problem is that when I add the speed never match in its position
                      > alwasy
                      > some pixels more or less is.
                      > -- Can you hep me please?
                      > -- thanks in advance
                      >
                      >
                      > property my
                      > property pCentralH --always show each slide in this position
                      > --property pSpeed
                      > global gMove
                      > global gNumSlide
                      > global gTotalSlides
                      > global gDirection
                      > --global gHowSlidesMove
                      >
                      > property pSlideWidth
                      > property pFramesPerSlide
                      > property pFramesLeft
                      > property pPixelsPerFrame
                      > property pMinH
                      >
                      >
                      > on beginSprite me ---------------------------------------------------
                      > -- ACTION: Works out how far and how fast to scroll the main image,
                      > -- how to make slides coincide with the frame, and where
                      > -- to stop scrolling
                      > -------------------------------------------------------------------
                      >
                      > -- <HARD-CODED values>
                      > my = sprite(3)
                      > --pSpeed=5
                      > gTotalSlides = 15 -- 37
                      > --gHowSlidesMove=1
                      > gDirection ="LEFT"
                      > gNumSlide =1
                      >
                      > pSlideWidth = 20
                      > pFramesPerSlide = 4
                      > pFramesLeft = 0
                      > -- </HARD-CODED values>
                      >
                      > -- Calculated values (assuming sprite 3 is currently aligned so
                      > -- that the frame is around image 1
                      > pCentralH = my.locH
                      > pMinH = pCentralH - pSlideWidth * (gTotalSlides - 1)
                      > pPixelsPerFrame = pSlideWidth / pFramesPerSlide -- = pSpeed
                      > end
                      >
                      >
                      >
                      > on exitFrame me -----------------------------------------------------
                      > -- ACTION: Scrolls the main image if gMove is TRUE or if the next
                      > -- slide does not yet coincide with the frame
                      > -------------------------------------------------------------------
                      >
                      > -- -- <FOR TESTING>
                      > -- gMove = the mouseDown
                      > -- gDirection = ["LEFT", "RIGHT"][the shiftDown + 1]
                      > -- -- </FOR TESTING>
                      >
                      > if gMove or pFramesLeft then
                      > MoveSlide me, gDirection --, gHowSlidesMove
                      > end if
                      > go to the frame
                      > end
                      >
                      >
                      >
                      > on MoveSlide me, direc ----------------------------------------------
                      > -- SOURCE: Sent by exitFrame() while gMove is TRUE, or until the
                      > -- image has scrolled so that the next little image fits
                      > -- into the frame
                      > -- INPUT: <NumSlides>
                      > -- ACTION: Moves the image in sprite 3 left or right
                      > -------------------------------------------------------------------
                      >
                      > pFramesLeft = (pFramesLeft + 1) mod pFramesPerSlide
                      >
                      > case direc of
                      > "LEFT":
                      > vLocH = my.locH - pPixelsPerFrame
                      > if vLocH < pMinH then
                      > vLocH = pMinH
                      > gMove = 0
                      > pFramesLeft = 0
                      > end if
                      >
                      > "RIGHT":
                      > vLocH = my.locH + pPixelsPerFrame
                      > if vLocH > pCentralH then
                      > vLocH = pCentralH
                      > gMove = 0
                      > pFramesLeft = 0
                      > end if
                      > end case
                      >
                      > if not pFramesLeft then
                      > gNumSlide = ((pCentralH - vLocH) / pSlideWidth) + 1
                      > end if
                      >
                      > my.locH = vLocH
                      > end MoveSlide
                      >


                      • 8. Re: some help with basic mathematic function
                        Level 7
                        Thank you very much for your help.
                        Yes, Is what I need.

                        I would like to move a number of slides, for example:
                        MoveSlide me, gDirection, NumSlidesToMove

                        MoveSlide me, "LEFT", 3 How can I do that?

                        Another thing. This behavior is not attached to any sprite (because is a
                        frame behavior) so, How to call "MoveSlide me, gDirection, NumSlidesToMove"
                        handler from a button?
                        Thanks again.



                        "openspark" <webforumsuser@macromedia.com> escribió en el mensaje
                        news:elt1u2$nuf$1@forums.macromedia.com...
                        > I've modified your code (see below). You say that there are 15 images, so
                        > I
                        > have set gTotalSlides to 15.
                        >
                        > Here's how the code works: it scrolls the main image 5 pixels per frame,
                        > but
                        > every 20th pixel it sets a property called pFramesLeft to 0. If
                        > pFramesLeft is
                        > 0, then the one of the slides coincides with the frame. If gMove is set
                        > to
                        > FALSE when pFramesLeft is not 0, then the exitFrame handler will continue
                        > to
                        > call MoveSlide until pFramesLeft is 0. In other words, the main image
                        > will
                        > continue to scroll until the next slide coincides with the frame.
                        >
                        > I've moved the calculations of the maximum and minimum values for my.locH
                        > to
                        > the beginSprite handler, so that fewer dynamic calculations are required.
                        >
                        > gSlide gets updated only when a slide coincides with the frame.
                        >
                        > Is this the sort of thing you are looking for?
                        >
                        >
                        >
                        > -- Hello:
                        > -- I am scrolling an image with 15 little images in it (20 pixels witdh
                        > each
                        > image).
                        > -- I want to show in a frame each image when I push a button. The image
                        > must
                        > scroll 20 pixels plus speed,
                        > -- the problem is that when I add the speed never match in its position
                        > alwasy
                        > some pixels more or less is.
                        > -- Can you hep me please?
                        > -- thanks in advance
                        >
                        >
                        > property my
                        > property pCentralH --always show each slide in this position
                        > --property pSpeed
                        > global gMove
                        > global gNumSlide
                        > global gTotalSlides
                        > global gDirection
                        > --global gHowSlidesMove
                        >
                        > property pSlideWidth
                        > property pFramesPerSlide
                        > property pFramesLeft
                        > property pPixelsPerFrame
                        > property pMinH
                        >
                        >
                        > on beginSprite me ---------------------------------------------------
                        > -- ACTION: Works out how far and how fast to scroll the main image,
                        > -- how to make slides coincide with the frame, and where
                        > -- to stop scrolling
                        > -------------------------------------------------------------------
                        >
                        > -- <HARD-CODED values>
                        > my = sprite(3)
                        > --pSpeed=5
                        > gTotalSlides = 15 -- 37
                        > --gHowSlidesMove=1
                        > gDirection ="LEFT"
                        > gNumSlide =1
                        >
                        > pSlideWidth = 20
                        > pFramesPerSlide = 4
                        > pFramesLeft = 0
                        > -- </HARD-CODED values>
                        >
                        > -- Calculated values (assuming sprite 3 is currently aligned so
                        > -- that the frame is around image 1
                        > pCentralH = my.locH
                        > pMinH = pCentralH - pSlideWidth * (gTotalSlides - 1)
                        > pPixelsPerFrame = pSlideWidth / pFramesPerSlide -- = pSpeed
                        > end
                        >
                        >
                        >
                        > on exitFrame me -----------------------------------------------------
                        > -- ACTION: Scrolls the main image if gMove is TRUE or if the next
                        > -- slide does not yet coincide with the frame
                        > -------------------------------------------------------------------
                        >
                        > -- -- <FOR TESTING>
                        > -- gMove = the mouseDown
                        > -- gDirection = ["LEFT", "RIGHT"][the shiftDown + 1]
                        > -- -- </FOR TESTING>
                        >
                        > if gMove or pFramesLeft then
                        > MoveSlide me, gDirection --, gHowSlidesMove
                        > end if
                        > go to the frame
                        > end
                        >
                        >
                        >
                        > on MoveSlide me, direc ----------------------------------------------
                        > -- SOURCE: Sent by exitFrame() while gMove is TRUE, or until the
                        > -- image has scrolled so that the next little image fits
                        > -- into the frame
                        > -- INPUT: <NumSlides>
                        > -- ACTION: Moves the image in sprite 3 left or right
                        > -------------------------------------------------------------------
                        >
                        > pFramesLeft = (pFramesLeft + 1) mod pFramesPerSlide
                        >
                        > case direc of
                        > "LEFT":
                        > vLocH = my.locH - pPixelsPerFrame
                        > if vLocH < pMinH then
                        > vLocH = pMinH
                        > gMove = 0
                        > pFramesLeft = 0
                        > end if
                        >
                        > "RIGHT":
                        > vLocH = my.locH + pPixelsPerFrame
                        > if vLocH > pCentralH then
                        > vLocH = pCentralH
                        > gMove = 0
                        > pFramesLeft = 0
                        > end if
                        > end case
                        >
                        > if not pFramesLeft then
                        > gNumSlide = ((pCentralH - vLocH) / pSlideWidth) + 1
                        > end if
                        >
                        > my.locH = vLocH
                        > end MoveSlide
                        >


                        • 9. Re: some help with basic mathematic function
                          Level 7
                          If you put a script on each sprite that needs to move like this:

                          on MoveSlide me, gDirection, NumSlidesToMove
                          --here you put the code for it
                          end

                          Then, on the button, you can use this to tell all the sprites with that
                          script to move:

                          sendAllSprites(#MoveSlide, "left", 3)
                          • 10. Re: some help with basic mathematic function
                            James Newton, ACP Level 3
                            Anne, do you mean that you want to move 1 sprite 3 slides-width to the left, or that you want to use this script with 3 separate sprites, each of which must move 1 slide to the left? Here's my solution for the first case:


                            • 11. Re: some help with basic mathematic function
                              Level 7
                              Thank you again.
                              Yes, Is the first case. To move 1 sprite any number of slides to the left or
                              right.
                              And how to call it from a button.
                              thanks again

                              "openspark" <webforumsuser@macromedia.com> escribió en el mensaje
                              news:em8rcv$l47$1@forums.macromedia.com...
                              > Anne, do you mean that you want to move 1 sprite 3 slides-width to the
                              > left, or
                              > that you want to use this script with 3 separate sprites, each of which
                              > must
                              > moveank 1 slide to the left? Here's my solution for the first case:
                              >
                              >
                              >
                              >
                              > property my
                              > property pCentralH --always show each slide in this position
                              > --property pSpeed
                              > global gMove
                              > global gNumSlide
                              > global gTotalSlides
                              > global gDirection
                              > --global gHowSlidesMove
                              >
                              > property pSlideWidth
                              > property pFramesPerSlide
                              > property pFramesLeft
                              > property pPixelsPerFrame
                              > property pMinH
                              >
                              > property pSlidesLeft
                              >
                              >
                              >
                              > on beginSprite me ---------------------------------------------------
                              > -- ACTION: Works out how far and how fast to scroll the main image,
                              > -- how to make slides coincide with the frame, and where
                              > -- to stop scrolling
                              > -------------------------------------------------------------------
                              >
                              > -- <HARD-CODED values>
                              > my = sprite(3)
                              > --pSpeed=5
                              > gTotalSlides = 15 -- 37
                              > --gHowSlidesMove=1
                              > gDirection ="LEFT"
                              > gNumSlide =1
                              >
                              > pSlideWidth = 20
                              > pFramesPerSlide = 4
                              > pFramesLeft = 0
                              > -- </HARD-CODED values>
                              >
                              > -- Calculated values (assuming sprite 3 is currently aligned so
                              > -- that the frame is around image 1
                              > pCentralH = my.locH
                              > pMinH = pCentralH - pSlideWidth * (gTotalSlides - 1)
                              > pPixelsPerFrame = pSlideWidth / pFramesPerSlide -- = pSpeed
                              > end
                              >
                              >
                              >
                              > on exitFrame me -----------------------------------------------------
                              > -- ACTION: Scrolls the main image if gMove is TRUE or if the next
                              > -- slide does not yet coincide with the frame
                              > -------------------------------------------------------------------
                              >
                              > -- -- <FOR TESTING>
                              > -- gMove = the mouseDown
                              > -- gDirection = ["LEFT", "RIGHT"][the shiftDown + 1]
                              > -- -- </FOR TESTING>
                              >
                              > if gMove or pFramesLeft or pSlidesLeft then
                              > MoveSlide me, gDirection --, gHowSlidesMove
                              > end if
                              > go to the frame
                              > end
                              >
                              >
                              >
                              > on MoveSlide me, direc, NumSlides -----------------------------------
                              > -- SOURCE: Sent by exitFrame() while gMove is TRUE, or until the
                              > -- image has scrolled so that the next little image fits
                              > -- into the frame
                              > -- INPUT: <direc> should be "LEFT" or "RIGHT"
                              > -- <NumSlides> can be an integer number of slides. If not,
                              > -- 1 is assumed
                              > -- ACTION: Moves the image in sprite 3 left or right by the number
                              > -- of slides indicated.
                              > -------------------------------------------------------------------
                              >
                              > pFramesLeft = (pFramesLeft + 1) mod pFramesPerSlide
                              >
                              > case (direc) of
                              > "LEFT", "RIGHT":
                              > gDirection = direc
                              > end case
                              >
                              > if integerP(NumSlides) then
                              > pSlidesLeft = NumSlides
                              > end if
                              >
                              > case direc of
                              > "LEFT":
                              > vLocH = my.locH - pPixelsPerFrame
                              > if vLocH < pMinH then
                              > vLocH = pMinH
                              > gMove = 0
                              > pFramesLeft = 0
                              > pSlidesLeft = 0
                              > end if
                              >
                              > "RIGHT":
                              > vLocH = my.locH + pPixelsPerFrame
                              > if vLocH > pCentralH then
                              > vLocH = pCentralH
                              > gMove = 0
                              > pFramesLeft = 0
                              > pSlidesLeft = 0
                              > end if
                              > end case
                              >
                              > if not pFramesLeft then
                              > gNumSlide = ((pCentralH - vLocH) / pSlideWidth) + 1
                              >
                              > if pSlidesLeft then
                              > pSlidesLeft = pSlidesLeft - 1
                              > end if
                              > end if
                              >
                              > my.locH = vLocH
                              > end MoveSlide
                              >


                              • 12. Re: some help with basic mathematic function
                                Level 7
                                Please, can you explain me what the pMinH property does?

                                "openspark" <webforumsuser@macromedia.com> escribió en el mensaje
                                news:em8rcv$l47$1@forums.macromedia.com...
                                > Anne, do you mean that you want to move 1 sprite 3 slides-width to the
                                > left, or
                                > that you want to use this script with 3 separate sprites, each of which
                                > must
                                > move 1 slide to the left? Here's my solution for the first case:
                                >
                                >
                                >
                                >
                                > property my
                                > property pCentralH --always show each slide in this position
                                > --property pSpeed
                                > global gMove
                                > global gNumSlide
                                > global gTotalSlides
                                > global gDirection
                                > --global gHowSlidesMove
                                >
                                > property pSlideWidth
                                > property pFramesPerSlide
                                > property pFramesLeft
                                > property pPixelsPerFrame
                                > property pMinH
                                >
                                > property pSlidesLeft
                                >
                                >
                                >
                                > on beginSprite me ---------------------------------------------------
                                > -- ACTION: Works out how far and how fast to scroll the main image,
                                > -- how to make slides coincide with the frame, and where
                                > -- to stop scrolling
                                > -------------------------------------------------------------------
                                >
                                > -- <HARD-CODED values>
                                > my = sprite(3)
                                > --pSpeed=5
                                > gTotalSlides = 15 -- 37
                                > --gHowSlidesMove=1
                                > gDirection ="LEFT"
                                > gNumSlide =1
                                >
                                > pSlideWidth = 20
                                > pFramesPerSlide = 4
                                > pFramesLeft = 0
                                > -- </HARD-CODED values>
                                >
                                > -- Calculated values (assuming sprite 3 is currently aligned so
                                > -- that the frame is around image 1
                                > pCentralH = my.locH
                                > pMinH = pCentralH - pSlideWidth * (gTotalSlides - 1)
                                > pPixelsPerFrame = pSlideWidth / pFramesPerSlide -- = pSpeed
                                > end
                                >
                                >
                                >
                                > on exitFrame me -----------------------------------------------------
                                > -- ACTION: Scrolls the main image if gMove is TRUE or if the next
                                > -- slide does not yet coincide with the frame
                                > -------------------------------------------------------------------
                                >
                                > -- -- <FOR TESTING>
                                > -- gMove = the mouseDown
                                > -- gDirection = ["LEFT", "RIGHT"][the shiftDown + 1]
                                > -- -- </FOR TESTING>
                                >
                                > if gMove or pFramesLeft or pSlidesLeft then
                                > MoveSlide me, gDirection --, gHowSlidesMove
                                > end if
                                > go to the frame
                                > end
                                >
                                >
                                >
                                > on MoveSlide me, direc, NumSlides -----------------------------------
                                > -- SOURCE: Sent by exitFrame() while gMove is TRUE, or until the
                                > -- image has scrolled so that the next little image fits
                                > -- into the frame
                                > -- INPUT: <direc> should be "LEFT" or "RIGHT"
                                > -- <NumSlides> can be an integer number of slides. If not,
                                > -- 1 is assumed
                                > -- ACTION: Moves the image in sprite 3 left or right by the number
                                > -- of slides indicated.
                                > -------------------------------------------------------------------
                                >
                                > pFramesLeft = (pFramesLeft + 1) mod pFramesPerSlide
                                >
                                > case (direc) of
                                > "LEFT", "RIGHT":
                                > gDirection = direc
                                > end case
                                >
                                > if integerP(NumSlides) then
                                > pSlidesLeft = NumSlides
                                > end if
                                >
                                > case direc of
                                > "LEFT":
                                > vLocH = my.locH - pPixelsPerFrame
                                > if vLocH < pMinH then
                                > vLocH = pMinH
                                > gMove = 0
                                > pFramesLeft = 0
                                > pSlidesLeft = 0
                                > end if
                                >
                                > "RIGHT":
                                > vLocH = my.locH + pPixelsPerFrame
                                > if vLocH > pCentralH then
                                > vLocH = pCentralH
                                > gMove = 0
                                > pFramesLeft = 0
                                > pSlidesLeft = 0
                                > end if
                                > end case
                                >
                                > if not pFramesLeft then
                                > gNumSlide = ((pCentralH - vLocH) / pSlideWidth) + 1
                                >
                                > if pSlidesLeft then
                                > pSlidesLeft = pSlidesLeft - 1
                                > end if
                                > end if
                                >
                                > my.locH = vLocH
                                > end MoveSlide
                                >


                                • 13. Re: some help with basic mathematic function
                                  James Newton, ACP Level 3
                                  Anne, please don't quote the entire message each time :-)

                                  The pMinH property determines position of the strip of slides when it has scrolled fully to the left, and is showing the last slide. pCentralH determines the position of the strip when it is scrolled fully to the right, and is showing the first slide. It would make more sense to rename this property pMaxH, but I maintained the name that you first gave it.

                                  I do not have a precise idea of how your sprites are laid out, or how you control them, so my code may do something different from what you are expecting. It is up to you to take the ideas contained in the code and adapt them to suit your own project.
                                  • 14. Re: some help with basic mathematic function
                                    Level 7
                                    Thank you very much and excuse me.

                                    If would be possible to know the number of slide where the mouse is
                                    rollover?
                                    thanks in advance


                                    • 15. Re: some help with basic mathematic function
                                      James Newton, ACP Level 3
                                      on mouseWithin(me)
                                      vOffset = the mouseH - my.left
                                      vSlideUnderMouse = (vOffset / pSlideWidth) + 1

                                      put vSlideUnderMouse -- or do something more imaginative
                                      end

                                      on mouseLeave(me)
                                      -- do something to indicate that there is no longer a slide under the mouse
                                      end