How do you load a bitmap file into a BitmapData object?

后端 未结 5 1760
遥遥无期
遥遥无期 2020-12-15 21:41

In Flash, the BitmapData object can be used to store bitmaps in RAM, you can later draw them to a MovieClip using the beginBitmapFill() method.

How do you load an ex

5条回答
  •  没有蜡笔的小新
    2020-12-15 22:01

    taking from cotton and will, this will display the bitmap after it is loaded:

    import flash.display.Bitmap;
    import flash.display.BitmapData;
    
    var bitmapData:BitmapData;
    var bmVis:Bitmap;
    
    var loader:Loader = new Loader();
        loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
        loader.load(new URLRequest("put url here"));
    
    function onComplete (event:Event):void
    {
        trace("loaded!");
        bitmapData = event.target.content.bitmapData;
        bmVis = new Bitmap(bitmapData);
        this.addChild(bmVis);
    }
    

提交回复
热议问题