Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 06-14-2011, 06:48 AM   #1
Registered User
Join Date: Jun 2011
Posts: 2
Default Passing FlashVars via PHP

Hello All,

I've scoured these forums, looked over ALL of the examples and spent the last 3 days pouring over my code to see what the problem is and I still can't figure it out. Here's the overview:

I have a php file that is passing a User ID (user) variable to a Flash (Flash8) swf file. The User ID is used to pull in specific information about the user and then other data is loaded (via AS2) that displays the users details.

I've tested this using browser url:
[full path removed]/flash/myswf.swf?user=22

And it works perfectly (both FF and IE). I then run the php script below and it seems my swf file is not receiving the user id variable (note full url paths have been removed):

PHP Code:
<?php session_start(); ?>
<!DOCTYPE html PUBLIC "[dtd link removed]">
<html xmlns="[xhtml link removed]">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>

<body style="margin:auto 0;text-align:center; vertical-align:middle;">
<div style="width:100%;text-align:center;" >
<script type="text/javascript">
AC_FL_RunContent( 'codebase','[swflash link removed]','width','500','height','375','user','<?php echo $_SESSION['_default']['user_id'];?>','title','MySWF','src','flash/myswf','quality','high','pluginspage','[ShockwaveFlash Path Removed]','movie','flash/myswf' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="[http cab file removed]" width="500" height="375" title="MySWF">
  <param name="movie" value="flash/myswf.swf" />
  <param name="quality" value="high" />
  <param name=FlashVars value="user=<?php echo $_SESSION['_default']['user_id'];?>" />
  <embed src="flash/myswf.swf" quality="high" pluginspage="[shockwave flash]" type="application/x-shockwave-flash" width="500" height="375" user="<?php echo $_SESSION['_default']['user_id'];?>"></embed>
I also checked the resulting page via my browser's View->Page Source which seems to show the FlashVars variable (user) is being properly passed (see below):

PHP Code:
<!DOCTYPE html PUBLIC "[dtd link removed]">
html xmlns="[xhtml link removed]">
meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>

<body style="margin:auto 0;text-align:center; vertical-align:middle;">
<div style="width:100%;text-align:center;" >
<script type="text/javascript">
AC_FL_RunContent( 'codebase','[swflash cab link removed]','width','500','height','375','user','22','title','MySWF','src','flash/myswf','quality','high','pluginspage','[shockwave link removed]','movie','flash/myswf' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="[swflash link removed]" width="500" height="375" title="MySWF">
  <param name="movie" value="flash/myswf.swf" />
  <param name="quality" value="high" />
  <param name=FlashVars value="user=22" />
  <embed src="flash/myswf.swf" quality="high" pluginspage="[ShockwaveFlash link removed]" type="application/x-shockwave-flash" width="500" height="375" user="22"></embed>


The problem I'm having is although the PHP script seems to be passing the correct User ID to the swf file - the swf file doesn't load the user's data which causes a "User Not Found" error.

But given that I can pass the user variable to the same swf file via my browser url address: [full path removed]/flash/myswf.swf?user=22 and everything works fine. Passing this via the php script does not work.

Any help would be very much appreciated!

winea is offline   Reply With Quote
Old 06-19-2011, 12:42 PM   #2
Learning Fast
audiopro's Avatar
Join Date: Dec 2009
Location: Morecambe
Posts: 757

What value, if any, is 'user' in your swf?
Website Engineers
audiopro is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

All times are GMT. The time now is 10:12 PM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.