flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [07/30] git commit: [flex-asjs] [refs/heads/develop] - teach constantbinding to handle static constants
Date Sat, 18 Oct 2014 05:43:24 GMT
teach constantbinding to handle static constants


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

Branch: refs/heads/develop
Commit: 6bbb7cbafaa14a4ede5ed023bc1b4baadb9e2563
Parents: 9d01a68
Author: Alex Harui <aharui@apache.org>
Authored: Mon Oct 13 12:47:48 2014 -0700
Committer: Alex Harui <aharui@apache.org>
Committed: Fri Oct 17 22:38:43 2014 -0700

----------------------------------------------------------------------
 .../org/apache/flex/binding/ConstantBinding.as  | 22 ++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/6bbb7cba/frameworks/as/projects/FlexJSUI/src/org/apache/flex/binding/ConstantBinding.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/binding/ConstantBinding.as
b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/binding/ConstantBinding.as
index ab8cca7..3e0970b 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/binding/ConstantBinding.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/binding/ConstantBinding.as
@@ -129,8 +129,26 @@ package org.apache.flex.binding
             if (destination == null)
                 destination = value;
             
-			source = document[sourceID];
-			destination[destinationPropertyName] = source[sourcePropertyName];
+            if (sourceID != null)
+    			source = document[sourceID];
+            else
+                source = document;
+            var value:*;
+            try 
+            {
+                value = source[sourcePropertyName];
+                destination[destinationPropertyName] = value;
+            } 
+            catch (e:Error)
+            {
+                try {
+                    value = source.constructor[sourcePropertyName];
+                    destination[destinationPropertyName] = value;
+                }
+                catch (e:Error)
+                {
+                }
+            }
 		}
 		
         /**


Mime
View raw message