I have a very complex Flash application (think Photoshop in Flash).
There is a lot of image manipulation, and all is working well with the exception of one bug.
The application has an undo/redo feature that sometimes throws an error. There is way too much code to paste here, but the issue revolves around this line of code:
trace("UNDO BMD: " + BeautyGlobal.undoArray[_undoSteps].bitmapData);
var newUndoData:BitmapData = BeautyGlobal.undoArray[_undoSteps].bitmapData.clone()
The trace statement displays:
UNDO BMD: [object BitmapData]
ArgumentError: Error #2015: Invalid BitmapData.
at flash.display::BitmapData/clone()
at Main/undoAction()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at com.beautyCanvas.ui::Toolbar/undoClick()
So there is bitmapdata there, but it is not valid. This issue doesn't preset itself all of the time. If I could detect if the bitmap data is valid, I can stop it from crashing the entire application. I have tried a few things:
- check the height of the BM Data (crashes the app with same error)
- looping through the BMD to get all of the properties... nothing comes up even before the error presents itself.
Any suggestions would be greatly appreciated.
Thanks!