royale-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [royale-asjs] 01/09: SWF views should use to attach to strand so regular addChild can be overridden (by emulation components, for example)
Date Sun, 05 Aug 2018 01:18:26 GMT
This is an automated email from the ASF dual-hosted git repository.

aharui pushed a commit to branch feature/MXRoyale
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git

commit 4d48183b44023340ed29ebcc236ec3d08fea7539
Author: Alex Harui <aharui@apache.org>
AuthorDate: Sat Aug 4 11:02:27 2018 -0700

    SWF views should use  to attach to strand so regular addChild can be overridden (by emulation
components, for example)
---
 .../org/apache/royale/html/accessories/TextPromptBead.as       |  4 ++--
 .../royale/org/apache/royale/html/beads/BackgroundImageBead.as |  2 +-
 .../main/royale/org/apache/royale/html/beads/HScrollBarView.as |  8 ++++----
 .../main/royale/org/apache/royale/html/beads/SpinnerView.as    |  4 ++--
 .../royale/org/apache/royale/html/beads/TextFieldViewBase.as   |  4 +---
 .../main/royale/org/apache/royale/html/beads/VScrollBarView.as |  8 ++++----
 .../main/royale/org/apache/royale/html/beads/WebBrowserView.as |  2 +-
 .../src/main/royale/org/apache/royale/core/ImageViewBase.as    | 10 ++++++++--
 8 files changed, 23 insertions(+), 19 deletions(-)

diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/accessories/TextPromptBead.as
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/accessories/TextPromptBead.as
index c75d84f..a36bc3b 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/accessories/TextPromptBead.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/accessories/TextPromptBead.as
@@ -135,11 +135,11 @@ package org.apache.royale.html.accessories
 			var model:Object = UIBase(_strand).model;
 			
 			if (model.text != null && model.text.length > 0 ) {
-				if (promptAdded) UIBase(_strand).removeChild(promptField);
+				if (promptAdded) UIBase(_strand).$removeChild(promptField);
 				promptAdded = false;
 			}
 			else {
-				if (!promptAdded) UIBase(_strand).addChild(promptField);
+				if (!promptAdded) UIBase(_strand).$addChild(promptField);
 				promptField.text = prompt;
 				promptAdded = true;
                 promptField.x = 2;
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/BackgroundImageBead.as
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/BackgroundImageBead.as
index f553af2..ea9d827 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/BackgroundImageBead.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/BackgroundImageBead.as
@@ -94,7 +94,7 @@ package org.apache.royale.html.beads
 					
 					bitmap = Bitmap(LoaderInfo(e.target).content);
 					
-					host.addChildAt(bitmap,0);
+					host.$addChildAt(bitmap,0);
 					
 					if (isNaN(host.explicitWidth) && isNaN(host.percentWidth))
 						host.setWidth(loader.content.width);
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/HScrollBarView.as
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/HScrollBarView.as
index 1e6d8f2..77cd622 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/HScrollBarView.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/HScrollBarView.as
@@ -86,10 +86,10 @@ package org.apache.royale.html.beads
 			_thumb = new Button();				
 			Button(_thumb).addBead(new HScrollBarThumbView());
             
-            UIBase(value).addChild(_decrement);
-            UIBase(value).addChild(_increment);
-            UIBase(value).addChild(_track);
-            UIBase(value).addChild(_thumb);
+            UIBase(value).$addChild(_decrement);
+            UIBase(value).$addChild(_increment);
+            UIBase(value).$addChild(_track);
+            UIBase(value).$addChild(_thumb);
             
             IEventDispatcher(_strand).addEventListener("widthChanged", changeHandler);
 
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/SpinnerView.as
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/SpinnerView.as
index 3f5cffc..52085c5 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/SpinnerView.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/SpinnerView.as
@@ -102,8 +102,8 @@ COMPILE::JS {
 				Button(_decrement).x = 0;
 				Button(_decrement).y = Button(_increment).height;
 
-				UIBase(_strand).addChild(_decrement);
-				UIBase(_strand).addChild(_increment);
+				UIBase(_strand).$addChild(_decrement);
+				UIBase(_strand).$addChild(_increment);
 				rangeModel = _strand.getBeadByType(IBeadModel) as IRangeModel;
 			}
 			IEventDispatcher(value).addEventListener("widthChanged",sizeChangeHandler);
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/TextFieldViewBase.as
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/TextFieldViewBase.as
index bfbe960..4db911b 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/TextFieldViewBase.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/TextFieldViewBase.as
@@ -18,8 +18,6 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.royale.html.beads
 {
-	import flash.display.DisplayObject;
-	import flash.display.DisplayObjectContainer;
 	import flash.text.StyleSheet;
 	
 	import org.apache.royale.core.CSSTextField;
@@ -95,7 +93,7 @@ package org.apache.royale.html.beads
             IEventDispatcher(_strand).addEventListener("widthChanged", widthChangeHandler);
             IEventDispatcher(_strand).addEventListener("heightChanged", heightChangeHandler);
             IEventDispatcher(_strand).addEventListener("sizeChanged", sizeChangeHandler);
-			DisplayObjectContainer(value).addChild(_textField);
+			UIBase(value).$addChild(_textField);
 
             var ilc:ILayoutChild = host as ILayoutChild;
             autoHeight = ilc.isHeightSizedToContent();
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/VScrollBarView.as
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/VScrollBarView.as
index 9fb1047..8aa9b8e 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/VScrollBarView.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/VScrollBarView.as
@@ -106,10 +106,10 @@ package org.apache.royale.html.beads
 			_thumb = new Button();				
 			Button(_thumb).addBead(new VScrollBarThumbView());
             
-            UIBase(value).addChild(_decrement);
-            UIBase(value).addChild(_increment);
-            UIBase(value).addChild(_track);
-            UIBase(value).addChild(_thumb);
+            UIBase(value).$addChild(_decrement);
+            UIBase(value).$addChild(_increment);
+            UIBase(value).$addChild(_track);
+            UIBase(value).$addChild(_thumb);
             
             IEventDispatcher(_strand).addEventListener("heightChanged", changeHandler);
             
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/WebBrowserView.as
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/WebBrowserView.as
index 37762fb..e84ec78 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/WebBrowserView.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/WebBrowserView.as
@@ -94,7 +94,7 @@ package org.apache.royale.html.beads
 			loader.y = 0;
 			loader.width = host.width;
 			loader.height = host.height;
-			(host as UIBase).addChild(loader);
+			(host as UIBase).$addChild(loader);
 		}
 
 		/**
diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/ImageViewBase.as
b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/ImageViewBase.as
index 49ab77f..d7fb687 100644
--- a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/ImageViewBase.as
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/ImageViewBase.as
@@ -174,12 +174,18 @@ package org.apache.royale.core
 			var hostSprite:Sprite = (host as IRenderedObject).$displayObject as Sprite;
 			
 			if (bitmap) {
-				hostSprite.removeChild(bitmap);
+                if ("$removeChild" in hostSprite)
+                    hostSprite["$removeChild"](bitmap);
+                else
+    				hostSprite.removeChild(bitmap);
 			}
 			
 			bitmap = Bitmap(LoaderInfo(event.target).content);
 			
-			hostSprite.addChild(bitmap);
+            if ("$addChild" in hostSprite)
+                hostSprite["$addChild"](bitmap);
+            else
+    			hostSprite.addChild(bitmap);
 			
             if (host.isWidthSizedToContent())
             {


Mime
View raw message