Fabrice, you rock!

var bmd:BitmapData = new BitmapData(srcSprite.width, srcSprite.height,
true, 0x00000000);

combined with

matSprite.transparent = true;

did the trick.


Thanks :)

On Jul 25, 2:37 pm, Fabrice3D <[email protected]> wrote:
> oops I see the method is beneath...
> try change var bmd:BitmapData = new BitmapData(srcSprite.width, 
> srcSprite.height);
> by something like var bmd:BitmapData = new BitmapData(srcSprite.width, 
> srcSprite.height, true, 0xFFFFFFFF);
>
> and var b:Bitmap = new Bitmap(bmd); what is it for?
>
> Fabrice
>
> On Jul 25, 2011, at 2:31 PM, 0L4F wrote:
>
>
>
>
>
>
>
> > Hello all,
>
> > I've set up an Away3D - Flash IDE project. I'm using Sprites from the
> > Flash library to create BitmapMaterials for Planes in Away3D.
>
> > I'd really like the Sprite's transparencies (alpha channel) to show up
> > in the BitmapMaterials, but I can't seem to get it to work :(
>
> > Here's my code:
>
> >                        textSprite = new TextSprite();   // Sprite
> > object from the Flash libraty
> >                    matSprite = new 
> > BitmapMaterial(getBitmapData(textSprite));
>
> >                    //matSprite.transparent = true;  // doesn't do the trick
>
> >                    matSprite.lights = [light1];
>
> >                    matSprite.diffuseMethod = new BasicDiffuseMethod();
> >                    matSprite.diffuseMethod.alphaThreshold = 0.5;            
> >  // no
> > luck!
>
> >                private function
> > getBitmapData(srcSprite:Sprite):BitmapData
> >            {
> >                    var bmd:BitmapData = new BitmapData(srcSprite.width,
> > srcSprite.height);
> >                    var b:Bitmap = new Bitmap(bmd);
> >                    bmd.draw(srcSprite);
> >                    return(bmd);
> >            }
>
> > I'd appreciate any hints / pointers! Thanks in advance,
>
> > 0L4F

Reply via email to