From: Rick W. <ri...@de...> - 2003-06-06 23:42:05
|
I have now gotten session passing working. (At least it looks like it is working, as it passes the right session ID values around. I still need to work in actually using variables within the session.) What you need to do: In the flashapp.html file look for two places that reference the .swf file you are embedding. One works for IE and the other for Netscape. <PARAM NAME=movie VALUE="flashapp.swf"> <PARAM... becomes <PARAM NAME=movie VALUE="flashapp.swf<?=$PHPSESSID?>"> <PARAM... and <EMBED src="flashapp.swf" quality=high bgcolor=... becomes <EMBED src="flashapp.swf?<?=$PHPSESSID?>" quality=high bgcolor=... Of course you will also need to rename flashapp.html to flashapp.php, and add a call to session_start() before you let it start to paint the page. I put it at the very top of the page. In your flash movie you need to change the gatewayurl definition: var gatewayurl = "http://dictionary.deafschool.net/gateway.php"; becomes: var gatewayurl = "http://dictionary.deafschool.net/gateway.php?PHPSESSID=" + SessionID; You can use a variable name other than SessionID, but be sure that you use the exact same name in the <PARAM> <EMBED> and when you append it to the gatewayurl. Finally, add a call to session_start() at the top of your gateway.php file, and you can maintain a PHP session as you move in and out of Flash. It is quitting time now, when I get back to work Monday I will look into a way to start a PHP session from within flash if one has not already been created. For testing you can create a dynamic text field and enter a valid PHP session id into it. If the variable bound to this text field matches the name of the variable part of your gatewayurl (I used SessionID) then you can keep a session alive while you are testing from the Flash IDE. Once I had a valid session ID, I just copied it into the field as a default value, and the session was re-opened every time I called AMFPHP. Rick |