4 Replies Latest reply on Mar 20, 2007 9:09 AM by smartino

    Flip cast member through Lingo.

    smartino Level 1
      Hi all,

      Is there a way of flipping a cast member through Lingo. I'm creating a cast member on the stage using different sprites. The cast member I've created then needs to be flipped as it gets put on an object in Shockwave 3D. I can flip a sprite, but I don't want to have to do this on the stage.

      Cheers in advance for any help on this.

      Simon.
        • 1. Re: Flip cast member through Lingo.
          johnAq Level 1
          You can flip an image using quads and Imaging Lingo

          Here's a function I grabbed from a forum archive

          on mFlipImageV (me, anImage)
          -- returns a new image
          aRect = anImage.rect
          aQuad = [point(0,0), point(aRect.width,0),
          point(aRect.width,aRect.height), point(0,aRect.height)]
          newQuad = [aQuad[4], aQuad[3], aQuad[2], aQuad[1]] -- flipV
          newImage = image(anImage.rect.width, anImage.rect.height, anImage.depth)
          newImage.copyPixels(anImage, newQuad, aRect)
          return newImage
          end

          hth

          johnAq
          • 2. Re: Flip cast member through Lingo.
            smartino Level 1
            Thanks for the reply johnAq. I did see that function from the archive myself, but it didn't seem to work for me. Have you got it to work yourself?

            I might not be using the function correctly. I've got a empty bitmap member and I've added this code before the return newImage...

            member("Blankimage").image = newImage

            Is this correct?

            Cheers Simon.
            • 3. Re: Flip cast member through Lingo.
              johnAq Level 1
              No, I didn't actually test it but it looks correct

              If you want to put a flipped version of "old image" into "Blankimage"

              member("Blankimage").image = mFlipImageV (me, member("old image").image)

              I just noticed the me parameter assume you are using a behaviour. If you want to flipH, change the line:
              newQuad = [aQuad[4], aQuad[3], aQuad[2], aQuad[1]] -- flipV
              to
              newQuad = [aQuad[2], aQuad[1], aQuad[4], aQuad[3]] -- flipH


              hth

              johnAq
              • 4. Re: Flip cast member through Lingo.
                smartino Level 1
                Not really sure why, but what you replied with worked when actually I had done the same thing a day before. Apologies and thanks very much for your help. I normally check my code thoroughly before troubling people with an issue I might have on this forum.

                It worked so cheers again.