1 Reply Latest reply on Feb 1, 2007 5:43 AM by James Newton, ACP

    Alpha Channel Problem

      I have a flash sprite on the stage and a 3D sprite with one object. I'm using (the stage).image to capture the screen of the flash sprite an apply this as a texture to the model in my 3D world. The problem is that my flash sprite has a .png image on a layer with an alpha channel and when I capture the screen of the director stage it is including this alpha channel. I want to get rid of this alpah and put my own (from a cast member) into the image object. So far all I've been able to do is combine the old alpha and my own alpha. I can't completely get rid of the flash alpha (which is causing my model to look semi-transparent).

      I'm using the following code to set my own alpha:

      b = image(512,512,8,#greyscale)
      tmp = member(1).image
      screen.setAlpha(b) -- screen si the screen capture of the stage
      screen.useAlpha = true

      I don't understand why the above code is combining the two alpha channels into one but its driving me completely batty!
        • 1. Re: Alpha Channel Problem
          James Newton, ACP Level 3
          When you capture the image of the stage, the image is entirely opaque. Where the Flash sprite is transparent, the stage.image will show the background colour of the stage, or the sprites behind the Flash sprite.

          To apply an alpha channel to the image, the following three statements must be true:
          * The image and the applied alpha channel image must be the same dimensions
          (Is the the stage 512 x 512 pixels)
          * The alpha channel image must be an 8-bit grayscale image (this is the case)
          * The image you are applying the alpha channel to must be a 32-bit image.
          If the screen resolution of the monitor is not 32-bit, then the screen.image
          will not be 32-bit.

          If setAlpha() works, it will return the value 1. If not, it returns 0.


          vResult = screen.setAlpha(b)
          if not vResult then
          alert "Check dimensions and bit depth of images"
          end if