Sorry, didn't see your comment at the bottom.

Karl


On Sep 9, 2010, at 7:28 AM, George Jones wrote:


From: k...@designdrumm.com
Subject: Re: [Flashcoders] Impossible?
Date: Wed, 8 Sep 2010 16:18:36 -0500
To: flashcoders@chattyfig.figleaf.com


On Sep 8, 2010, at 1:15 PM, George Jones wrote:

  if (gp < 1050112)
                {
                    _redArray.push(0);
                    _alphaArray.push(255);
                    _greenArray.push(0);
                    _blueArray.push(255);



Shouldn't this be
  _blueArray.push(0);

and only alphaArray should be set to 255?
That may be why your getting a blue background.

First up, I fixed the flame coming back. As I supposed, that was easy. The problem remains with making the background disappear. I've reworked the code some:

                gp = _fireColor.getPixel(i, 0);
                if (_bitmapFlag == true && gp < 1050112)
                {
                    _redArray.push(255);
                    _alphaArray.push(0);
                    _greenArray.push(255);
                    _blueArray.push(255);
                } else if (_bitmapFlag == false && gp < 1050112) {
                    _redArray.push(gp);
                    _alphaArray.push(0);
                    _greenArray.push(255);
                    _blueArray.push(255);
                } else {
                    _redArray.push(gp);
                    _alphaArray.push(0);
                    _greenArray.push(0);
                    _blueArray.push(0);
                }

I've changed the if statement. Values of gp less than 1050112 are that which are not the flame, therefore are the background which should be set to alpha=0. When _bitmapFlag == true, then it's the mask that's being painted; otherwise, the sprite being masked (the else if statement). The final else statement is for the flame itself. Interestingly, changing the value of either the blue, green or alpha of that final else statement to 255 gives a blue flame with white border and very attractive, though not what I want. I wonder why changing the alpha especially would have that effect.

I guess what I'm not clear about is the values I'm pushing. If I push
255 for the red, green and blue arrays, does that result in white? If I
push 0 for alpha, is that the same as alpha=0 or alpha=1?



Here again is the code for building the sprites:

        private function _onLoadedAll(e:Event):void
        {
            _onLoadedContent(e, _bitmapFlag = false);
            _onLoadedContent(e, _bitmapFlag = true);
        }

private function _onLoadedContent(e:Event, _bitmapFlag:Boolean):void { _fireColor = Bitmap(LoaderInfo (e.target).loader.content).bitmapData;
...
            if (_bitmapFlag == false)
            {
_fire = new BitmapData(865, 92, _bitmapFlag, 0xffffff);
                addChild(new Bitmap(_fire));
                _fireSprite.addChild(new Bitmap(_fireMask));
                addChild(_fireSprite);
                _fireSprite.mask = _fireMaskSprite;
                _fireSprite.cacheAsBitmap = true;
            } else {
_fireMask = new BitmapData(865, 92, _bitmapFlag, 0xffffff);
                _fireMaskSprite.addChild(new Bitmap(_fireMask));
                addChild(_fireMaskSprite);
                _fireMaskSprite.cacheAsBitmap = true;
            }

I'm wondering now if this is possible, to mask the flame only and let the background show.


The following combinations give me a blue background and flame:

                if (gp < 1050112)
                {
                    _redArray.push(255);
                    _alphaArray.push(0);
                    _greenArray.push(255);
                    _blueArray.push(255);

                if (gp < 1050112)
                {
                    _redArray.push(0);
                    _alphaArray.push(255);
                    _greenArray.push(0);
                    _blueArray.push(255);

                if (gp < 1050112)
                {
                    _redArray.push(0);
                    _alphaArray.push(255);
                    _greenArray.push(255);
                    _blueArray.push(255);

                if (gp < 1050112)
                {
                    _redArray.push(255);
                    _alphaArray.push(255);
                    _greenArray.push(255);
                    _blueArray.push(255);

This gives me a black background:

                if (gp < 1050112)
                {
                    _redArray.push(0);
                    _alphaArray.push(255);
                    _greenArray.push(0);
                    _blueArray.push(0);

TIA,
George
                                          
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Karl DeSaulniers
Design Drumm
http://designdrumm.com

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to