3 Replies Latest reply on May 27, 2006 3:03 AM by Newsgroup_User

    Spacing sprites problem...

    Level 7
      Hi!

      I am automatically spacing sprites in channels 2 to 11 using the
      following lingo:

      yCoordinate = sprite(2).bottom
      repeat with i = 2 to 10
      yCoordinate = yCoordinate + lineSpacing
      sprite(i+1).top = yCoordinate
      updatestage
      yCoordinate = yCoordinate + (sprite(i+1).bottom - sprite(i+1).top)
      end repeat


      The problem: This works only for the first few sprites, the following
      ones don't place correctly.

      Example: Sprites 3 to 5 place correctly.

      For sprite 6 a yCoordinate value of 630 is calculated. When setting

      sprite(i+1).top = yCoordinate

      sprite(i+1).top gets a value of only 612, the following sprites are
      misplaced as well.

      This only works when using locv - why is that?

      Thanks!
      Martin
        • 1. Re: Spacing sprites problem...
          Level 7
          Setting a sprite's top property does not move the sprite - it merely alters
          its rect. If you want the sprite to move, then set its locV.

          --
          Dave -
          Adobe Community Expert
          www.blurredistinction.com
          www.macromedia.com/support/forums/team_macromedia/


          • 2. Re: Spacing sprites problem...
            Level 7
            One more thing, I think you want to just set yCoordinate to
            sprite(i+1).bottom within the repeat loop:

            yCoordinate = sprite(2).bottom + lineSpacing
            repeat with i = 2 to 10
            sprite(i+1).locV = yCoordinate
            updatestage
            yCoordinate = sprite(i+1).bottom + lineSpacing
            end repeat

            --
            Dave -
            Adobe Community Expert
            www.blurredistinction.com
            www.macromedia.com/support/forums/team_macromedia/


            • 3. Re: Spacing sprites problem...
              Level 7
              DMennenoh **AdobeCommunityExpert** schrieb:
              > One more thing, I think you want to just set yCoordinate to
              > sprite(i+1).bottom within the repeat loop:
              >
              > yCoordinate = sprite(2).bottom + lineSpacing
              > repeat with i = 2 to 10
              > sprite(i+1).locV = yCoordinate
              > updatestage
              > yCoordinate = sprite(i+1).bottom + lineSpacing
              > end repeat
              >

              Ah, okay. Thanks for your comments, then I just misunderstood the online
              help.

              Best regards
              Martin