Flex retrieves parameters from the page url (Summary)
Flash Builder 4: http://g.csdn.net/5128184
I used to take notes on how flex transmits parameters to a page, flex can also pass parameters to the flex page through URLLoader + URLRequest + URLVariables in non-AmfPHP interaction with the background. The receiving parameters on the backend php end are very simple. Now we will discuss how the flex end processes the parameters transmitted from the page url.
There are a lot of articles on the Internet, but there are some problems. I will summarize them and write them here.
Method 1: flex receives the webpage Value !~
1 <? Xml version = "1.0" encoding = "UTF-8"?>
2 <mx: Application xmlns: mx = "http://www.adobe.com/2006/mxml" layout = "absolute"
3 applicationComplete = "initApp ()">
4
5 <mx: Label text =
6 "Will run the app deployed at http: // {serverURL }:{ port}/MyGreatApp.html"/>
7 <mx: Script>
8 <! [CDATA [
9 [Bindable]
10 var serverURL: String;
11
12 [Bindable]
13 var port: String;
14
15 function initApp (): void {
16 serverURL = Application. application. parameters. serverURL;
17 port = Application. application. parameters. port
18}
19]>
20 </mx: Script>
21 </mx: Application>
At the end of the article, I wrote: is the external part test.swf? ServerURL = String & port = String is called on the webpage !"
There is no problem with doing so, but usually the flex program uses html as the container to wrap the swf file. If test.html? ServerURL = String & amp; port = String is used to pass the parameter, and the parameter cannot be obtained using the code provided in this Article.