      *  @private
      *  Utility function that sets the underlying bitmapData property.
      */
-    private function setBitmapData(bitmapData:BitmapData):void
+    private function setBitmapData(bitmapData:BitmapData, internallyCreated:Boolean = false):void
     {         
         // Clear previous bitmapData
         if (_bitmapData)
         {
-            _bitmapData.dispose();
+            if (bitmapDataCreated) // Dispose the bitmap if we created it
+                _bitmapData.dispose();
             _bitmapData = null;
         }
+        
+        bitmapDataCreated = internallyCreated; 
 
         _bitmapData = bitmapData;
         

            _scaleGridRight = NaN;
            _scaleGridTop = NaN;
            _scaleGridBottom = NaN;
            
            if (value is Class)
            {
                var cls:Class = Class(value);
                value = new cls();
            }
            else if (value is String)
            {

            {
                bitmapData = new BitmapData(tmpSprite.width, tmpSprite.height, true, 0);
                bitmapData.draw(tmpSprite, new Matrix());
                currentBitmapCreated = true;
                
                if (tmpSprite.scale9Grid)
                {
