We want to pass variables from a query string into our Flex application.
Using PHP we can get the variables from the query string and load them in through our Flash object tag.
.../index.php?fname=nick&lname=sokachwe can use the GET method before our html tag in index.php that will grab our variables:
<?PHPThese variables can now be loaded into our Flex application by editing the AC_FL_RunContent method (which will be created in index.php by Flex Builder). This method is used to embed the Flash content into the page. Notice I have appended to the 'flashvars' variable.
$first_name = $_GET['fname'];
$last_name = $_GET['lname'];
?>
<HTML>...
AC_FL_RunContent(
"src", "showcaseBooklet",
"width", "100%",
"height", "100%",
"align", "middle",
"id", "showcaseBooklet",
"quality", "high",
"bgcolor", "#869ca7",
"name", "showcaseBooklet",
"flashvars",'historyUrl=history.htm%3F&lconid='+lc_id+'&fname=<?php echo $first_name ?>&lname=<?php echo $last_name ?>',
"allowScriptAccess","sameDomain",
"type", "application/x-shockwave-flash",
"pluginspage", "http://www.adobe.com/go/getflashplayer"
);
Now when the Flex application loads it will have "nick" set to fname and "sokach" set to lname.