1. Transmit parameters (message, ABC) from flash to PhP. 2. Flash receives parameters ($ phpmessage, $ phpabc) from PHP ); 3. Output Parameters from flash in PHP
As3 is written as follows:
1 <? PHP
2
3 $ flashdata =$ _ post ['message']; // receives the messgae variable from FLASH;
4 $ flashabc = $ _ post ['abc']; // receives the variable ABC from flash.
5 $ phpmessage = 'im PHP message! '; // Transfer value to flash $ phpmessage
6 $ phpabc = 'transfer phpabc to flash'; // transfer value to flash $ phpabc
7
8 // print the variable to be transmitted;
9 echo 'phpmessage = $ phpmessage ';
10 echo "& amp; flashmessage = $ flashdata ";
11 echo "& amp; flashmas = $ flashabc ";
12 echo "& amp; phpabc = $ phpabc ";
13 // echo "phpmessage = $ phpmessage & amp; flashmessage = $ flashdata & amp; flashmas = $ flashabc & amp; phpabc = $ phpabc ";
14?>;
1 import flash. Text. textfield;
2
3 var Loader: urlloader = new urlloader ();
4 // declare a URLRequest
5 var <a href = "URLRequest"> URL: URLRequest </a> = new URLRequest ("test. php ");
6 // set the transmission mode to post
7 URL. method = urlrequestmethod. post;
8 // declare a urlvariables
9 VaR values: urlvariables = new urlvariables ();
10 // set the information to be transmitted (message, ABC)
11 values. Message = "Hello im flash! ";
12 values. ABC = "ABC in flash ";
13 URL. Data = values;
14 loader. dataformat = urlloaderdataformat. variables;
15 loader. addeventlistener (event. Complete, loaded );
16 function loaded (E: Event ){
17 // output parameters passed from PhP. phpmessage is the value of the variable $ phpmessage in the received PHP. flashmessage and flashmas receive parameters transmitted from flash
18 // the message and ABC values of the two variables in PHP are used to check whether the value is successfully transferred;
19 Trace (loader. Data. phpmessage );
20 trace (loader. Data. flashmessage );
21 trace (loader. Data. flashmas );
22 // print the values of these variables;
23 var T: textfield = new textfield ();
24 T. width = 300;
25 t. Height = 500;
26 T. wordwrap = true;
27 T. appendtext ("\ n PHP variable phpmessage =" + loader. Data. phpmessage );
28 T. appendtext ("\ NPHP variable flashmessage =" + loader. Data. flashmessage );
29 T. appendtext ("\ NPHP variable flashmas =" + loader. Data. flashmas );
30 t. appendtext ("\ n PHP variable phpabc =" + loader. Data. phpabc );
31 addchild (t );
32}
33 loader. Load (URL );
34
PHP is written as follows: