states need to handle state-dependent events

Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/201a01f0
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/201a01f0
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/201a01f0

Branch: refs/heads/develop
Commit: 201a01f04e38ae32acdd86da7addb6baa35d6064
Parents: 85da2f0
Author: Alex Harui <[email protected]>
Authored: Wed Oct 29 10:24:51 2014 -0700
Committer: Alex Harui <[email protected]>
Committed: Wed Oct 29 11:15:43 2014 -0700

----------------------------------------------------------------------
 .../org/apache/flex/core/SimpleStatesImpl.as    | 25 ++++++++++++++++++++
 1 file changed, 25 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/201a01f0/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/SimpleStatesImpl.as
----------------------------------------------------------------------
diff --git 
a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/SimpleStatesImpl.as 
b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/SimpleStatesImpl.as
index 754b008..6fb6457 100644
--- 
a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/SimpleStatesImpl.as
+++ 
b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/SimpleStatesImpl.as
@@ -21,6 +21,7 @@ package org.apache.flex.core
     import flash.display.DisplayObject;
     
     import mx.states.AddItems;
+    import mx.states.SetEventHandler;
     import mx.states.SetProperty;
     import mx.states.State;
     
@@ -129,6 +130,18 @@ package org.apache.flex.core
                     else
                         sp.document[sp.name] = sp.previousValue;
                 }
+                else if (o is SetEventHandler)
+                {
+                    var seh:SetEventHandler = SetEventHandler(o);
+                    if (seh.target != null)
+                    {
+                        seh.document[seh.target].removeEventListener(seh.name, 
seh.handlerFunction);
+                    }
+                    else
+                    {
+                        seh.document.removeEventListener(seh.name, 
seh.handlerFunction);
+                    }
+                }
             }
         }
         
@@ -190,6 +203,18 @@ package org.apache.flex.core
                         sp.document[sp.name] = sp.value;                       
 
                     }
                 }
+                else if (o is SetEventHandler)
+                {
+                    var seh:SetEventHandler = SetEventHandler(o);
+                    if (seh.target != null)
+                    {
+                        seh.document[seh.target].addEventListener(seh.name, 
seh.handlerFunction);
+                    }
+                    else
+                    {
+                        seh.document.addEventListener(seh.name, 
seh.handlerFunction);
+                    }
+                }
             }            
         }
        }

Reply via email to