Flex obtains parameters from the page (*. swf) url

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.