This is an automated email from the ASF dual-hosted git repository.

harbs 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 481592e  Implemented parameters for Spark Application (copied from MX 
Application).
     new f5a6fec  Merge pull request #957 from 
estanglerbm/sparkapplication-parameters
481592e is described below

commit 481592ed26933396b88eda043810df08689fb655
Author: Edward Stangler <[email protected]>
AuthorDate: Thu Nov 26 05:54:40 2020 -0600

    Implemented parameters for Spark Application (copied from MX Application).
---
 .../main/royale/spark/components/Application.as    | 56 +++++++++++++++-------
 1 file changed, 40 insertions(+), 16 deletions(-)

diff --git 
a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/Application.as
 
b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/Application.as
index 0f2e813..642fcb0 100644
--- 
a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/Application.as
+++ 
b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/Application.as
@@ -1265,15 +1265,10 @@ public class Application extends SkinnableContainer 
implements IStrand, IParent,
     //  parameters
     //----------------------------------
 
+    private var _parameters:Object;
+    
     /**
-     *  @private
-     *  Storage for the parameters property.
-     *  This variable is set in the initialize() method of SystemManager.
-     */
-    // mx_internal var _parameters:Object;
-
-    /**
-     *  An Object containing name-value
+     *  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
@@ -1282,16 +1277,45 @@ public class Application extends SkinnableContainer 
implements IStrand, IParent,
      *  <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 10
-     *  @playerversion AIR 1.5
-     *  @productversion Flex 4
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
      */
-    // public function get parameters():Object
-    // {
-        // return _parameters;
-    // }
+    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;
+        }
+    }
+
+    public function set parameters(value:Object):void
+    {
+        // do nothing in SWF.  It is determined by loaderInfo.
+        COMPILE::JS
+        {
+            _parameters = value;
+        }
+    }
 
     //----------------------------------
     //  resizeForSoftKeyboard

Reply via email to