states were being output in subdocuments
diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/royale/MXMLRoyaleEmitter.java b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/royale/MXMLRoyaleEmitter.java
index 56b39d1..fdfe0ec 100644
--- a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/royale/MXMLRoyaleEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/royale/MXMLRoyaleEmitter.java
@@ -746,6 +746,7 @@
     {
         ArrayList<MXMLDescriptorSpecifier> oldDescriptorTree;
         MXMLDescriptorSpecifier oldPropertiesTree;
+        MXMLDescriptorSpecifier oldStateOverrides;
         ArrayList<MXMLEventSpecifier> oldEvents;
         ArrayList<IMXMLScriptNode> oldScripts;
         ArrayList<MXMLDescriptorSpecifier> oldCurrentInstances;
@@ -774,7 +775,9 @@
         currentInstances = new ArrayList<MXMLDescriptorSpecifier>();
         oldCurrentPropertySpecifiers = currentPropertySpecifiers;
         currentPropertySpecifiers = new ArrayList<MXMLDescriptorSpecifier>();
-
+        oldStateOverrides = currentStateOverrides;
+        currentStateOverrides = new MXMLDescriptorSpecifier();
+        
         oldEventCounter = eventCounter;
         eventCounter = 0;
         oldIdCounter = idCounter;
@@ -827,6 +830,7 @@
 
         descriptorTree = oldDescriptorTree;
         propertiesTree = oldPropertiesTree;
+        currentStateOverrides = oldStateOverrides;
         events = oldEvents;
         scripts = oldScripts;
         currentInstances = oldCurrentInstances;