allow static constant binding

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

Branch: refs/heads/develop
Commit: 10206f2d0133e01cf3da3174b77485cbf2fa46b8
Parents: 0b6ed38
Author: Alex Harui <[email protected]>
Authored: Mon Dec 22 09:59:13 2014 -0800
Committer: Alex Harui <[email protected]>
Committed: Mon Dec 22 09:59:13 2014 -0800

----------------------------------------------------------------------
 .../src/org/apache/flex/binding/ConstantBinding.js  | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/10206f2d/frameworks/js/FlexJS/src/org/apache/flex/binding/ConstantBinding.js
----------------------------------------------------------------------
diff --git 
a/frameworks/js/FlexJS/src/org/apache/flex/binding/ConstantBinding.js 
b/frameworks/js/FlexJS/src/org/apache/flex/binding/ConstantBinding.js
index 8662b9f..d70a374 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/binding/ConstantBinding.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/binding/ConstantBinding.js
@@ -46,7 +46,17 @@ 
org.apache.flex.binding.ConstantBinding.prototype.FLEXJS_CLASS_INFO =
 org.apache.flex.binding.ConstantBinding.prototype.set_strand = function(value) 
{
   org.apache.flex.binding.ConstantBinding.base(this, 'set_strand', value);
 
-  this.destination['set_' + this.destinationPropertyName](
-      this.source['get_' + this.sourcePropertyName]()
-  );
+  var val;
+  try {
+    val = this.source['get_' + this.sourcePropertyName]();
+  } catch (e) {
+    try {
+      val = this.source.constructor[this.sourcePropertyName];
+    } catch (e2) {
+    }
+  }
+  if (typeof(this.destination['set_' + this.destinationPropertyName]) === 
'function')
+    this.destination['set_' + this.destinationPropertyName](val);
+  else
+    this.destination[this.destinationPropertyName] = val;
 };

Reply via email to