PDA

View Full Version : How to make FLASH import PHP variables...


unbelievable
12-12-2006, 08:27 AM
Hello.


QUESTIONS:

1. Does FLASH fail to import certain PHP variable types?

2. HOW would one pass PHP variables to FLASH correctly, WHEN those variables have been carried to the PHP script from another PHP script?


REASON FOR QUESTION:

I have a FLASH movie that imports some PHP variables, but not others. All the variables behave the same in PHP.


FACTS:
I have a FLASH movie that imports PHP variables into a dynamic text box. From what I have observed, Actionscript only imports variables that are set as follows:

Ex. 1 : Flash imports variables where the value is written in directly.

$text = "city";


Ex. 2: Flash imports variables where the value is the result of a query on the same script.

$conn = db_connect();

$sql = 'SELECT Site FROM course_catalogue ORDER BY RAND() LIMIT 1';

if( ($result = mysql_query($sql)) === FALSE )
{echo mysql_error();} else

while ($row = mysql_fetch_assoc($result))
{extract($row);


Probably sounds reasonable enough. But, the issue I'm having is that I must carry variables from my initial query through a series of other scripts (by POSTing them to a url or as part of a function).

When I need to import my variables to FLASH, they print $myvar; and echo $myvar; normally and appear to behave as any other variable for PHP purposes. Flash, however, does not recognize them.

Your help is greatly appreciated.

Cota
12-12-2006, 08:50 AM
In my opinion, one of the more stable ways to import variables from PHP is to use the "&" in front the variable name you wish to use. This is very useful when using LoadVars().
example

echo "&VarName=".$myVar;


Then you would have the LoadVars() object look for "VarName".