You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2015/11/26 19:14:49 UTC

[08/12] git commit: [flex-asjs] [refs/heads/core_js_to_as] - try to fix ImageAndTextButton

try to fix ImageAndTextButton


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

Branch: refs/heads/core_js_to_as
Commit: c517931ac7b368e3911220d071a6db5dbc554ccd
Parents: 522a4cc
Author: Alex Harui <ah...@apache.org>
Authored: Wed Nov 25 14:04:31 2015 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Wed Nov 25 14:04:31 2015 -0800

----------------------------------------------------------------------
 .../org/apache/flex/html/ImageAndTextButton.as  | 29 ++++++++++++++++++++
 1 file changed, 29 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c517931a/frameworks/projects/HTML/as/src/org/apache/flex/html/ImageAndTextButton.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/ImageAndTextButton.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/ImageAndTextButton.as
index 2c6b5ec..dd88427 100644
--- a/frameworks/projects/HTML/as/src/org/apache/flex/html/ImageAndTextButton.as
+++ b/frameworks/projects/HTML/as/src/org/apache/flex/html/ImageAndTextButton.as
@@ -50,6 +50,19 @@ package org.apache.flex.html
 		}
 		
         /**
+         *  @private
+         */
+        COMPILE::JS
+        override public function set text(value:String):void
+        {
+            ImageAndTextModel(model).text = value;
+            COMPILE::JS
+            {
+                setInnerHTML();                    
+            }
+        }
+        
+        /**
          *  The URL of an icon to use in the button
          *  
          *  @langversion 3.0
@@ -68,6 +81,10 @@ package org.apache.flex.html
         public function set image(value:String):void
         {
             ImageAndTextModel(model).image = value;
+            COMPILE::JS
+            {
+                setInnerHTML();                    
+            }
         }
         
         /**
@@ -86,5 +103,17 @@ package org.apache.flex.html
             return element;
         }        
 
+        /**
+         */
+        COMPILE::JS
+        protected function setInnerHTML():void
+        {
+            var inner:String = '';
+            if (image != null)
+                inner += "<img src='" + image + "'/>";
+            inner += '&nbsp;';
+            inner += text;
+            element.innerHTML = inner;
+        };
 	}
 }