     
     private function awm_activatedFormHandler(event:DynamicEvent):void
     {
+        updateProxyImageForTopmostForm();
+    }
+    
+    private function awm_deactivatedFormHandler(event:DynamicEvent):void
+    {
+        // When the ActiveWindowManager dispatches the deactivatedForm event,
+        // its internal list of forms has not been updated yet. So, determining
+        // the topmost form from that list will fail and find the old topmost
+        // form (the one that is going away). Always assume that the form passed
+        // as the event property will be the new topmost form.
         var form:Object = event.hasOwnProperty("form") ? event.form : null;
-        // Both the activatedForm and deactivatedForm events pass the form that
-        // is becoming active as the "form" property.
-        updateProxyImageForForm(form);
-    }
-    
-    private function awm_deactivatedFormHandler(event:DynamicEvent):void
-    {
-        var form:Object = event.hasOwnProperty("form") ? event.form : null;
-        // Both the activatedForm and deactivatedForm events pass the form that
-        // is becoming active as the "form" property.
         updateProxyImageForForm(form);
     }
     


import mx.core.DPIClassification;
import mx.core.FlexGlobals;
import mx.core.IUIComponent;
import mx.core.LayoutDirection;
import mx.core.UIComponent;

            
            // If this is a new StageText created while a popup is already open,
            // a proxy image needs to be created for it.
            updateProxyImageForTopmostForm();
        }
        
        updateProxyImage();
