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 2014/10/10 16:34:57 UTC

[10/16] git commit: [flex-asjs] [refs/heads/develop] - send size change events if needed when image arrives

send size change events if needed when image arrives


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

Branch: refs/heads/develop
Commit: ce5f83ed039724be3a3309a9833318dfa123b78d
Parents: c7f8a2d
Author: Alex Harui <ah...@apache.org>
Authored: Thu Oct 9 14:25:53 2014 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Fri Oct 10 07:34:33 2014 -0700

----------------------------------------------------------------------
 .../src/org/apache/flex/html/beads/ImageView.as | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ce5f83ed/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ImageView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ImageView.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ImageView.as
index c3911d2..2bbed3e 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ImageView.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/ImageView.as
@@ -96,15 +96,20 @@ package org.apache.flex.html.beads
 		 */
 		private function onComplete(event:Object):void
 		{
+            var host:UIBase = UIBase(_strand);
 			if (bitmap) {
-				UIBase(_strand).removeChild(bitmap);
+				host.removeChild(bitmap);
 			}
 			
 			bitmap = Bitmap(LoaderInfo(event.target).content);
 			
-			UIBase(_strand).addChild(bitmap);
+			host.addChild(bitmap);
 			
-			handleSizeChange(null);
+            if (isNaN(host.explicitWidth) && isNaN(host.percentWidth))
+                host.dispatchEvent(new Event("widthChanged"));
+            if (isNaN(host.explicitHeight) && isNaN(host.percentHeight))
+                host.dispatchEvent(new Event("heightChanged"));
+                
 		}
 		
 		/**
@@ -112,9 +117,12 @@ package org.apache.flex.html.beads
 		 */
 		private function handleSizeChange(event:Object):void
 		{
-			if (bitmap) {
-				bitmap.width = UIBase(_strand).width;
-				bitmap.height = UIBase(_strand).height;
+            var host:UIBase = UIBase(_strand);
+            if (bitmap) {
+                if (!isNaN(host.explicitWidth) || !isNaN(host.percentWidth))
+	    			bitmap.width = UIBase(_strand).width;
+                if (!isNaN(host.explicitHeight) || !isNaN(host.percentHeight))
+    				bitmap.height = UIBase(_strand).height;
 			}
 		}
 	}