actionscript-3 – 为什么BitmapData不透明?

栏目: JavaScript · 发布时间: 6年前

内容简介:翻译自:https://stackoverflow.com/questions/12121466/why-isnt-the-bitmapdata-transparent
var subimage = new Bitmap();
    subimage.bitmapData = new BitmapData(25, 25, true, 0);
    addChild(subimage);

从我读过的所有内容来看,这应该是透明的.我看到一个大黑方块.可能导致什么?

这没有意义:我尝试了以下代码:

package
{
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.display.Sprite;

public class TestBitMap extends Sprite
    {
        public function TestBitMap() {
            var imageYellow:Bitmap = new Bitmap(new BitmapData(100, 100, true, 0xFFFFFF00));
            var imageTransparent:Bitmap = new Bitmap(new BitmapData(100, 100, true, 0));
            var imageSemiTransparent:Bitmap = new Bitmap(new BitmapData(100, 100, true, 0x99000000));
            imageTransparent.x = 25;
            imageTransparent.y = 25;
            imageSemiTransparent.x = 50;
            imageSemiTransparent.y = 50;
            addChild(imageYellow);
            addChild(imageTransparent);
            addChild(imageSemiTransparent);
        }       
    }
}

我有一个黄色的盒子,上面有一个半透明的黑盒子. “imageTransparent”完全不可见.

我还尝试了首先创建BitMap的方法,然后更改了bitmapData.没有区别,仍然是看不见的.

San.chez:0等于0x00000000,无论如何.它是一个无符号整数,ActionScript并没有神奇地改变它.你的链接很好.

翻译自:https://stackoverflow.com/questions/12121466/why-isnt-the-bitmapdata-transparent


以上所述就是小编给大家介绍的《actionscript-3 – 为什么BitmapData不透明?》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

The Art of Computer Programming, Volume 2

The Art of Computer Programming, Volume 2

Knuth, Donald E. / Addison-Wesley Professional / 1997-11-04 / USD 79.99

Finally, after a wait of more than thirty-five years, the first part of Volume 4 is at last ready for publication. Check out the boxed set that brings together Volumes 1 - 4A in one elegant case, and ......一起来看看 《The Art of Computer Programming, Volume 2》 这本书的介绍吧!

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具