hi guys

should be a quickie for someone

i've got a bitmapdata object which is being written to by a quickie drawing
api that i wrote. It works absolutely great. The problem is that when i
.dispose() of the attached bitmap, i cannot write to it any more

i've tried recreating it but with no joy - i really hope you can help


<code>
var mcBitmap: MovieClip = this.mcBitmap;
var bmp:BitmapData= new BitmapData(169, 136, true, 0x000000);
this.onMouseDown = startDrawing;
this.onMouseUp = stopDrawing;

function setupClearButton():Void
{
    mcClearButton.onRelease = function():Void
    {
        bmp.dispose(); // clears the bmp
        bmp = new BitmapData(169, 136, true, 0x000000); // tried to
reinstantiate the bitmapdata but it doesn't work
    }
}


function startDrawing():Void
{
    setLineStyle(); // set linestyle to current style

    var point:Object = {x:_xmouse, y:_ymouse}; // object to be used with
globalToLocal to change to local coordinates
    mcDrawing.globalToLocal(point);
    mcDrawing.moveTo(point.x, point.y);

        this.onMouseMove = function():Void
        {
            var point:Object = {x:_xmouse, y:_ymouse}; // object to be used
with globalToLocal to change to local coordinates
            mcDrawing.globalToLocal(point);
            mcDrawing.lineTo(point.x, point.y);
        }
    }
}

function setLineStyle():Void
{
    mcDrawing.lineStyle(nLineWeight, nCurrentColour, nLineAlpha);
}

function stopDrawing():Void
{
        delete this.onMouseMove;

        bmp.draw(mcDrawing); // copy user stroke to bmp BitmapData

        mcDrawing.clear(); // clear user drawing
    }
}

</code>

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

Reply via email to