 			m_rootElement = this;
 			m_containingBlock = this;
 			m_invalidChildren = [];
-			stage.addEventListener(Event.RESIZE, stage_resize);
+			stage.addEventListener(Event.RESIZE, stage_resize, false, 0, true);
+			addEventListener(Event.REMOVED_FROM_STAGE, self_removedFromStage, false, 0, true);
 			super.initialize();
 			stage.stageFocusRect = false;
 			m_focusManager = new FocusManager(this);
 			
 			m_debugInterface = new DebugInterface(this);
 		}
-		
+
 		protected override function initDefaultStyles() : void
 		{
 			m_elementDefaultStyles.setStyle('width', '100%');


package reprise.ui
{
	import reprise.debug.DebugInterface;
	import reprise.core.ApplicationContext;
	import reprise.core.FocusManager;
	import reprise.core.UIRendererFactory;
	import reprise.core.reprise;
	import reprise.css.CSS;
	import reprise.css.CSSDeclaration;
	import reprise.events.DisplayEvent;

	import flash.display.StageScaleMode;
	import flash.events.Event;
	import flash.utils.clearTimeout;
	import flash.utils.getTimer;
	
	use namespace reprise;

		
		protected function stage_resize(event : Event) : void
		{
			if (stage && ((m_widthIsRelative && m_contentBoxWidth != stage.stageWidth) || 
				(m_heightIsRelative && m_contentBoxHeight != stage.stageHeight)))
			{
				stageDimensionsChanged = true;
				invalidateStyles();
