You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2018/08/05 01:18:27 UTC
[royale-asjs] 02/09: get parameters property working
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 d70affe765de722380936ba3583fe58e53f6654e
Author: Alex Harui <ah...@apache.org>
AuthorDate: Sat Aug 4 11:03:38 2018 -0700
get parameters property working
---
.../src/main/royale/mx/core/Application.as | 43 ++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/core/Application.as b/frameworks/projects/MXRoyale/src/main/royale/mx/core/Application.as
index 6b74431..b9da637 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/core/Application.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/Application.as
@@ -379,6 +379,49 @@ public class Application extends Container implements IStrand, IParent, IEventDi
}
}
+ private var _parameters:Object;
+
+ /**
+ * The parameters property returns an Object containing name-value
+ * pairs representing the parameters provided to this Application.
+ *
+ * <p>You can use a for-in loop to extract all the names and values
+ * from the parameters Object.</p>
+ *
+ * <p>There are two sources of parameters: the query string of the
+ * Application's URL, and the value of the FlashVars HTML parameter
+ * (this affects only the main Application).</p>
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public function get parameters():Object
+ {
+ COMPILE::SWF
+ {
+ return loaderInfo.parameters;
+ }
+ COMPILE::JS
+ {
+ if (!_parameters)
+ {
+ _parameters = {};
+ var query:String = location.search.substring(1);
+ if(query)
+ {
+ var vars:Array = query.split("&");
+ for (var i:int=0;i<vars.length;i++) {
+ var pair:Array = vars[i].split("=");
+ _parameters[pair[0]] = decodeURIComponent(pair[1]);
+ }
+ }
+ }
+ return _parameters;
+ }
+ }
+
/**
* This method gets called when all preinitialize handlers
* no longer call preventDefault();