 			{
 				var n:int = forms.length;
 				var p:DisplayObject = DisplayObject(event.target);
-				var isApplication:Boolean = document is IRawChildrenContainer ? 
-											IRawChildrenContainer(document).rawChildren.contains(p) :
-											document.contains(p);
+                                var isApplication:Boolean = document.rawChildren.contains(p);
 				while (p)
 				{
 					for (var i:int = 0; i < n; i++)

		if (isDispatchingResizeEvent)
			return;

		var w:Number;
		var h:Number;
                var m:Number;
                var n:Number;
                

        // the sandbox root and align to StageAlign.TOP_LEFT.                        
        try 
        {
            if (stage)
            {
            w = stage.stageWidth;
            h = stage.stageHeight;
                align = stage.align;
        }
        }
        catch (error:SecurityError)
        {
