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 2020/04/15 09:46:54 UTC

[royale-asjs] 02/05: Fix for ExternalInterface calls with member access

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

commit cb4df561ede120049ea33f4ef0866207ea6a57cb
Author: greg-dove <gr...@gmail.com>
AuthorDate: Wed Apr 15 20:05:48 2020 +1200

    Fix for ExternalInterface calls with member access
---
 .../src/main/royale/mx/external/ExternalInterface.as      | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/external/ExternalInterface.as b/frameworks/projects/MXRoyale/src/main/royale/mx/external/ExternalInterface.as
index e27e64f..7899ca8 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/external/ExternalInterface.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/external/ExternalInterface.as
@@ -168,7 +168,20 @@ package mx.external
             COMPILE::JS
             {
                 // find a function with the name...
-                var fnc : Function = window[functionName];
+                var fnc : Function;
+                if (functionName) {
+                    var base:Object = window;
+                    var dotIdx:int = functionName.indexOf('.');
+                    if (dotIdx != -1) {
+                        while(dotIdx != -1) {
+                            base = base[functionName.substr(0, dotIdx)];
+                            functionName = functionName.substr(dotIdx + 1);
+                            dotIdx = functionName.indexOf('.');
+                        }
+                    }
+                    fnc = base[functionName];
+                }
+
                 if (fnc)
                 {
                     return fnc.apply(null, args);