English 中文(简体)
ArgumentError: Error #2015: Invalid BirmapData
原标题:ArgumentError: Error #2015: Invalid BitmapData

我在装上了一张标书。 我正在犯以下错误:

Engine Init //trace
loadimage//trace
ArgumentError: Error #2015: Invalid BitmapData.
    at flash.display::BitmapData()

下面是我的法典。 这似乎是在追踪负荷之后发生的。

package com.objects {

    import flash.display.Sprite;
    import flash.display.BitmapData;
    import flash.display.Bitmap;
    import flash.geom.Point;
    import flash.geom.Rectangle;
    import flash.display.Loader;
    import flash.net.URLRequest;
    import flash.net.*;
    import flash.events.*;
    import flash.display.LoaderInfo;

    public class gameObject extends Sprite {

        protected var w:Number;
        protected var h:Number;
        protected var image:BitmapData;
        protected var canvas:Bitmap;
        protected var px:Number;
        protected var py:Number;

        public function gameObject():void
        {
            init();
        }

        private function init():void
        {

        }

        public function loadImage(imageDir:String, w:Number, h:Number, px:Number, py:Number):void
        {
            this.w = w;
            this.y = y;
            this.px = px;
            this.py = py;

            trace("loadimage");
            var loader:Loader = new Loader();
            loader.contentLoaderInfo.addEventListener(Event.COMPLETE,imageComplete);
            loader.load(new URLRequest(imageDir));
        }

         private function imageComplete(e:Event):void {
            var loader:LoaderInfo = LoaderInfo(e.target);

            image = Bitmap(loader.content).bitmapData;
            drawImage();
         }

         private function drawImage():void
         {
            var tilePoint:Point = new Point(0,0);
            var tileRect = new Rectangle(py,px,w,h);
            trace(loader.content);
            var canvasData:BitmapData = new BitmapData(w,h);
            trace("got canvas data");
            canvasData.copyPixels(image,tileRect,tilePoint);
            trace("copied pixels");
            canvas = new Bitmap(canvasData);
         }
    }
}

我这样说了。

balls = new Array();
            balls[0] = new gameObject();
            balls[0].loadImage("com/images/ball.gif", 15,15,0,0);

当我追踪洛纳德人时,情况如下:

Engine Init
loadimage
[object Bitmap]
ArgumentError: Error #2015: Invalid BitmapData.
    at flash.display::BitmapData()
问题回答

闪电器 9人只支持2880个食肉和高血。

检查贵方的形象是否太大。 我将这一错误带在超过3 000个图象的图像上。

我认为,你要提到电子目标,而不是LoaderInfo。 跟踪(载荷)在图像线前正确,看看它是否告诉你数据内容的类型。

改变你的形象

private function imageComplete(e:Event):void {
    var loader:LoaderInfo = LoaderInfo(e.target);
    var bitmap:Bitmap = loader.content as Bitmap;
    if(bitmap){
        image = bitmap.bitmapData;
        drawImage();
    } else {
        trace("invalid data!");
    }
}

这应当允许你在错误发生之前追捕。 下一个问题是,我们的轨道图是 par。

Ok , 现在我已经确定。 如果你仔细研究该法典,你就会看到,为我这个阶级定了财产Y。

我只是想chim笑话,并说,我把这个错误用在一份<>PNG”的档案上,该档案用的是一刀切的书写/拆卸。

当我随后用<代码>Loader / URLRequest将填满的、<代码>loader.content 的财产交还<代码>Bitmap时,该编码有有效<编码>width和

但是,一旦你尝试获取六氯苯(getPixel32,copyPixels,或Texture.uploadFromBitmapData,该数据即行文:

ArgumentError: Error #2015: Invalid BitmapData.

我通过这一法典解决了:

    if (myMC.width > 1&& myMC.height>1 && myMC.width<3000&& myMC.height<3000){          
        bitmapData = new BitmapData(myMC.width,myMC.height,true,1);
    }   else{
        bitmapData = new BitmapData(500,500,true,1);
    }   




相关问题
Disable button tooltip in AS3

I want to disable the tooltip on certain buttons. The tooltip manager seems to be an all or nothing solution. Is it possible to disable the tooltip for just one or two buttons?

Sorting twodimensional Array in AS3

So, i have a two-dimensional Array of ID s and vote count - voteArray[i][0] = ID, voteArray[i][1] = vote count I want the top 3 voted items to be displayed in different colors, so i have a 2nd Array -...

Virtual Tour using sketch up, ajax, flash technologies

I want to know if there are existing technology that make your 3d models in sketch into virtual tours, using either Ajax or Flash for web presentation. If there s none, which will be a good approach ...

AS3 try/catch out of memory

I m loading a few huge images on my flex/as3 app, but I can t manage to catch the error when the flash player runs out of memory. Here is the what I was thinking might work (I use ???? because i dont ...

Red5 Security Tutorial

I am looking for a step by step tutorial on securing Red5 from intrusion. This seems to be a question that comes up alot in a google search, but is never really answered in a way that makes sense to ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

visible property of DisplayObject

For example I have a hierarchy of movie clips. mc1 is a child of mc, and mc2 is a child of mc1. Turns out that when I set mc1.visible = false; mc2.visible stays true. Is that supposed to happen?...

热门标签