You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by gr...@apache.org on 2021/12/14 03:53:33 UTC
[royale-asjs] branch develop updated: implement SystemManager getChildByName & add util support for implementation elsewhere.
This is an automated email from the ASF dual-hosted git repository.
gregdove pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
The following commit(s) were added to refs/heads/develop by this push:
new 76525f4 implement SystemManager getChildByName & add util support for implementation elsewhere.
76525f4 is described below
commit 76525f4397dd2746656475f6dd350353ac2159e7
Author: greg-dove <gr...@gmail.com>
AuthorDate: Tue Dec 14 16:53:23 2021 +1300
implement SystemManager getChildByName & add util support for implementation elsewhere.
---
.../src/main/royale/mx/managers/SystemManager.as | 13 +++++++++++--
.../MXRoyaleBase/src/main/royale/mx/utils/RoyaleUtil.as | 17 ++++++++++++++++-
2 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/managers/SystemManager.as b/frameworks/projects/MXRoyale/src/main/royale/mx/managers/SystemManager.as
index da78766..8853fba 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/managers/SystemManager.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/managers/SystemManager.as
@@ -98,6 +98,8 @@ import org.apache.royale.core.IUIBase;
import org.apache.royale.events.IEventDispatcher;
import org.apache.royale.geom.Rectangle;
+import mx.utils.RoyaleUtil;
+
//--------------------------------------
// Events
//--------------------------------------
@@ -3736,8 +3738,15 @@ public class SystemManager extends SystemManagerBase implements ISystemManager,
{ override }
public function getChildByName(name:String):IUIComponent
{
- trace("getChildByName not implemented");
- return null;
+ COMPILE::SWF
+ {
+ return super.getChildByName(name) as IUIComponent;
+ }
+ COMPILE::JS
+ {
+ return RoyaleUtil.childByName(this, name);
+ }
+
}
/**
diff --git a/frameworks/projects/MXRoyaleBase/src/main/royale/mx/utils/RoyaleUtil.as b/frameworks/projects/MXRoyaleBase/src/main/royale/mx/utils/RoyaleUtil.as
index 42337a0..a6e2d81 100644
--- a/frameworks/projects/MXRoyaleBase/src/main/royale/mx/utils/RoyaleUtil.as
+++ b/frameworks/projects/MXRoyaleBase/src/main/royale/mx/utils/RoyaleUtil.as
@@ -18,7 +18,8 @@
////////////////////////////////////////////////////////////////////////////////
package mx.utils
{
-
+import mx.core.IUIComponent;
+import mx.core.IChildList;
COMPILE::SWF{
@@ -33,6 +34,8 @@ COMPILE::SWF{
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion Royale 0.9.9
+ *
+ * @royalesuppressexport
*/
public class RoyaleUtil
{
@@ -72,6 +75,18 @@ public class RoyaleUtil
private static var deferreds:Array = [];
+
+ COMPILE::JS
+ public static function childByName(parent:IChildList, name:String):IUIComponent{
+ var i:uint = 0;
+ var l:uint = parent.numChildren;
+ for (;i<l;i++) {
+ var child:IUIComponent = parent.getChildAt(i);
+ if (child && child.name == name) return child;
+ }
+ return null;
+ }
+
}
}