6 Replies Latest reply on Mar 14, 2007 11:21 AM by newmfa

    repeat image

    newmfa Level 1
      Hi all,

      if there is an image sprite how can lingo make this event:
      "image move from bottom to top and when reach the top of screen repeat itself from bottom"

      regards
      newmfa
        • 1. Re: repeat image
          Level 7
          You might create a behavior like this. This may not be exavtly what you want
          (you haven't provided a full description) but it should get you started. For
          example this requires the sprite's regPoint be (0,0).
          --------------------------------------
          property pPixelsPerFrame, spriteNum

          on beginSprite me
          pPixelsPerFrame = 5 -- speed
          end

          on exitFrame me
          if sprite(spriteNum).locV > 0 then
          if sprite(spriteNum).locV - pPixelsPerFrame > 0 then
          sprite(spriteNum).locV = sprite(spriteNum).locV - pPixelsPerFrame
          else
          sprite(spriteNum).locV = 0
          end if
          else
          sprite(spriteNum).locV = the stage.rect[4] - the stage.rect[2] -
          sprite(spriteNum).height
          end if
          end
          ------------------------------------------

          "newmfa" <webforumsuser@macromedia.com> wrote in message
          news:et21or$oc8$1@forums.macromedia.com...
          > Hi all,
          >
          > if there is an image sprite how can lingo make this event:
          > "image move from bottom to top and when reach the top of screen repeat
          itself from bottom"
          >
          > regards
          > newmfa


          • 2. Re: repeat image
            newmfa Level 1
            sorry, it didn't work..
            here is the movie http://www.geocities.com/newmfa/loop.dir

            you see movie 320x240px and in right side there is an image..my aim is move this image from bottom to top and any pixels hidden in top side shown in bottom side again repeatly..

            newmfa
            • 3. Re: repeat image
              Level 7
              Well, strictly speaking it did work, just not the way you wanted it to. Now
              with your extra descirption I believe I understand what you want. This can
              be accomplished using imaging lingo. Here is a behavior I quickly wrote. No
              doubt it can be improved upon, but it should get you started.

              To apply it, you need to create a second bitmap cast member identical to the
              one in your file that you named loop. Name the new one loop2. Do not place
              it one the stage, just leave in the cast.

              Next, apply the following behavior to the sprite on the stage. Run the
              program and watch it go. There is a spped parameter you can increase to make
              it go faster. Some of the longer lines of code will probably get wrapped by
              your news reader, you will have to put them back on one line if they do. If
              you need me to, I can email you a small demo file.

              ------------------------------------------------
              property pPixelsScrolled, pBaseMember, pScrollSpeed, spriteNum

              on beginSprite me
              pPixelsScrolled = 0
              pScrollSpeed = 1
              pBaseMember = member("loop2")
              end

              on exitFrame
              if pPixelsScrolled = sprite(spriteNum).height then
              pPixelsScrolled = 0
              else
              if pPixelsScrolled + pScrollSpeed > sprite(spriteNum).height then
              pPixelsScrolled = sprite(spriteNum).height
              else
              pPixelsScrolled = pPixelsScrolled + pScrollSpeed
              end if
              end if
              sprite(spriteNum).member.image = createCurrentImage(pBaseMember,
              pPixelsScrolled)
              end

              on createCurrentImage initial_Image, pixelsScrolled
              x = image(initial_Image.width, initial_Image.height, 24)
              x.copyPixels(initial_Image.image,
              rect(0,0,initial_Image.width,initial_Image.height - pixelsScrolled),
              rect(0,pixelsScrolled,initial_Image.width,initial_Image.height))
              x.copyPixels(initial_Image.image, rect(0,initial_Image.height -
              pixelsScrolled,initial_Image.width,initial_Image.height),
              rect(0,0,initial_Image.width,pixelsScrolled))
              return x
              end
              ----------------------------------------------------------

              "newmfa" <webforumsuser@macromedia.com> wrote in message
              news:et39i8$9i5$1@forums.macromedia.com...
              > sorry, it didn't work..
              > here is the movie http://www.geocities.com/newmfa/loop.dir
              >
              > you see movie 320x240px and in right side there is an image..my aim is
              move
              > this image from bottom to top and any pixels hidden in top side shown in
              bottom
              > side again repeatly..
              >
              > newmfa
              >
              >


              • 4. Re: repeat image
                newmfa Level 1
                i got window error:

                script error: Unexpected end of statement

                sprite(spriteNum).member.image = createCurrentImage(pBaseMember,


                i tried put "end" after previous statement but I got the same
                newmfa
                • 5. Re: repeat image
                  Level 7
                  I warned you that your news reader was going to insert line breaks into the
                  longer lines of code. Inserting "end" isn't going to do you any good.

                  For example script below should all be on ONE line, even though it gets
                  broken into two lines because it it too long for the news reader.

                  sprite(spriteNum).member.image = createCurrentImage(pBaseMember,
                  pPixelsScrolled)

                  After you fix that you will get more errors because of long lines in the
                  createCurrrentImage handler below that. There should only be 4 lines inside
                  the handler

                  x = image...
                  x.copyPixels...
                  x.copyPixels...
                  return x

                  Do you understand?


                  • 6. Re: repeat image
                    newmfa Level 1
                    well done, thanks worked well..

                    greeting
                    newmfa