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/09/25 18:03:45 UTC

[03/50] git commit: [flex-asjs] [refs/heads/develop] - allow as bead of view as well as component

allow as bead of view as well as component


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

Branch: refs/heads/develop
Commit: 61191face972cd9876a78209b2b865afd95304ef
Parents: 12904aa
Author: Alex Harui <ah...@apache.org>
Authored: Mon Sep 15 13:33:56 2014 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Sep 23 14:49:39 2014 -0700

----------------------------------------------------------------------
 .../flex/html/beads/SolidBackgroundBead.as      | 24 +++++++++++++-------
 1 file changed, 16 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/61191fac/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/SolidBackgroundBead.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/SolidBackgroundBead.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/SolidBackgroundBead.as
index 605664f..255b4e3 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/SolidBackgroundBead.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/beads/SolidBackgroundBead.as
@@ -18,11 +18,13 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.flex.html.beads
 {
+    import flash.display.Sprite;
 	import flash.display.Graphics;
 	
 	import org.apache.flex.core.IBead;
+    import org.apache.flex.core.IBeadView;
 	import org.apache.flex.core.IStrand;
-	import org.apache.flex.core.UIBase;
+	import org.apache.flex.core.IUIBase;
 	import org.apache.flex.core.ValuesManager;
 	import org.apache.flex.events.Event;
 	import org.apache.flex.events.IEventDispatcher;
@@ -52,6 +54,8 @@ package org.apache.flex.html.beads
 				
 		private var _strand:IStrand;
 		
+        private var host:IUIBase;
+        
         /**
          *  @copy org.apache.flex.core.IBead#strand
          *  
@@ -63,15 +67,20 @@ package org.apache.flex.html.beads
 		public function set strand(value:IStrand):void
 		{
 			_strand = value;
-            IEventDispatcher(value).addEventListener("heightChanged", changeHandler);
-            IEventDispatcher(value).addEventListener("widthChanged", changeHandler);
+            if (value is IUIBase)
+                host = IUIBase(value);
+            else if (value is IBeadView)
+                host = IUIBase(IBeadView(value).host);
+            
+            IEventDispatcher(host).addEventListener("heightChanged", changeHandler);
+            IEventDispatcher(host).addEventListener("widthChanged", changeHandler);
 			
-			var bgColor:Object = ValuesManager.valuesImpl.getValue(value, "background-color");
+			var bgColor:Object = ValuesManager.valuesImpl.getValue(host, "background-color");
 			if( bgColor != null ) {
-				backgroundColor = uint(bgColor);
+				backgroundColor = ValuesManager.valuesImpl.convertColor(bgColor);
 			}
 			
-			var bgAlpha:Object = ValuesManager.valuesImpl.getValue(value, "opacity");
+			var bgAlpha:Object = ValuesManager.valuesImpl.getValue(host, "opacity");
 			if( bgAlpha != null ) {
 				opacity = Number(bgAlpha);
 			}
@@ -129,8 +138,7 @@ package org.apache.flex.html.beads
 		
 		private function changeHandler(event:Event):void
 		{
-            var host:UIBase = UIBase(_strand);
-            var g:Graphics = host.graphics;
+            var g:Graphics = Sprite(host).graphics;
             var w:Number = host.width;
             var h:Number = host.height;