Invalid BitmapData?

by GreekFellows
I run this in FlashDevelop and it gives an error and tells me Invalid BitmapData.
And seemingly in wonderfl it only shows one sprite.
Any explanation?
♥0 | Line 86 | Modified 2012-07-05 22:42:04 | MIT License
play

ActionScript3 source code

/**
 * Copyright GreekFellows ( http://wonderfl.net/user/GreekFellows )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/ri8o
 */

package 
{
    import flash.display.BitmapData;
    import flash.display.DisplayObject;
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.geom.Matrix;
    import flash.geom.Point;
    import flash.geom.Rectangle;
    import flash.text.TextField;
    import flash.text.TextFormat;
    
    /**
     * ...
     * @author Greek Fellows
     */
    public class Main extends Sprite 
    {
        private var array:Array;
        
        private const letters:Array = "abcdefghijklmnopqrstuvwxyz".split("");
        
        public function Main():void 
        {
            this.array = [];
            
            this.addEventListener(Event.ENTER_FRAME, packedletters);
            this.addEventListener(Event.ENTER_FRAME, grow);
        }
        
        private function packedletters(e:Event):void {
            if (Math.floor(Math.random() * 1) == 0) {
                var sprite:Sprite = new Sprite();
                sprite.x = Math.floor(Math.random() * 465);
                sprite.y = Math.floor(Math.random() * 465);
                sprite.scaleX = 0;
                sprite.scaleY = 0;
                
                var tf:TextField = new TextField();
                tf.text = letters[Math.floor(Math.random() * letters.length)];
                
                var fm:TextFormat = new TextFormat();
                fm.font = "Segoe UI Light";
                fm.size = Math.floor(Math.random() * 200) + 100;
                fm.align = "center";
                
                tf.setTextFormat(fm);
                
                tf.width = tf.textWidth;
                tf.height = tf.textHeight + 5;
                tf.x = - tf.textWidth / 2;
                tf.y = - tf.textHeight / 2;
                
                sprite.addChild(tf);
                
                this.addChild(sprite);
                
                this.array.push(true);
            }
        }
        
        private function grow(e:Event):void {
            for (var i:int = 0; i < this.numChildren; i++) {
                var s:Sprite = this.getChildAt(i) as Sprite;
                
                if (array[i]) {
                    s.scaleX += .005;
                    s.scaleY += .005;
                }
                
                for (var di:int = 0; di < this.numChildren; di++) {
                    if (i != di) {
                        if (hit(this.getChildAt(i), this.getChildAt(di))) {
                            array[i] = false;
                            array[di] = false;
                        }
                    }
                }
            }
        }
        
        private function hit(target1:DisplayObject, target2:DisplayObject):Boolean {
            var bool:Boolean = false;
            
            var target2Rect:Rectangle = target2.getBounds(this);
            var target2Offset:Matrix = target2.transform.matrix;
            target2Offset.tx = target2.x - target2Rect.x;
            target2Offset.ty = target2.y - target2Rect.y;    
            
            var target2BmpData:BitmapData = new BitmapData(target2Rect.width, target2Rect.height, true, 0);
            target2BmpData.draw(target2, target2Offset);        
            
            var target1Rect:Rectangle = target1.getBounds(this);
            var target1BmpData:BitmapData = new BitmapData(target1Rect.width, target1Rect.height, true, 0);
            
            var target1Offset:Matrix = target1.transform.matrix;
            target1Offset.tx = target1.x - target1Rect.x;
            target1Offset.ty = target1.y - target1Rect.y;    
            
            target1BmpData.draw(target1, target1Offset);    
            
            var rLoc:Point = new Point(target1Rect.x, target1Rect.y);
            var bLoc:Point = new Point(target2Rect.x, target2Rect.y);    
            
            if (target1BmpData.hitTest(rLoc, 255, target2BmpData, bLoc, 255)) {
                bool = true;
            }
            
            target2BmpData.dispose();
            target1BmpData.dispose();
            
            return bool;
        }
        
    }
    
}