Astraport
Astraport

Reputation: 1257

ArgumentError: Error #2015: Invalid BitmapData. on iOS

The simplest graffiti app. The code works fine on the desktop and on Android. If i try to do the same on iOS (tested on a real device - iPad 2), i get this error: ArgumentError: Error # 2015: Invalid BitmapData.

In principle, it is clear why the error - the size of BitmapData is the huge.

Why it happens? And why only on iOS?

private var maskLine:Sprite = new Sprite();
stage.addEventListener(MouseEvent.MOUSE_MOVE,onMove);
stage.addEventListener(MouseEvent.MOUSE_DOWN,onDown);
stage.addEventListener(MouseEvent.MOUSE_UP,onUp);

protected function onDown(ev:MouseEvent):void {
maskLine.graphics.lineStyle(20, 0x33CC00, 1);
maskLine.graphics.moveTo(mouseX, mouseY);
stage.addEventListener(MouseEvent.MOUSE_MOVE, onMove);
}
protected function onUp(ev:MouseEvent):void {
    stage.removeEventListener(MouseEvent.MOUSE_MOVE, onMove);
}

protected function onMove(ev:MouseEvent):void {
    maskLine.graphics.lineTo(mouseX, mouseY);
}

Save in bitmap code:

        maskLine.filters = [new BlurFilter(4, 4, 1)];
        trace (Capabilities.screenResolutionX + '   ' + Capabilities.screenResolutionY + '  ' + maskLine.width + '   ' + maskLine.height);
    //768    1024    107374182.35    107374182.35
// Here is get error
        var bmpd:BitmapData = new BitmapData(maskLine.width, maskLine.height, true, 0x000000);
        bmpd.draw(maskLine);

Upvotes: 0

Views: 1521

Answers (1)

Related Questions