Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using PHP Scripts in Flash MX

Status
Not open for further replies.

dsokyno1

IS-IT--Management
Jul 4, 2003
6
0
0
US
Hello Everyone,
I'm posting a variable called "player" to a destination php script file(test.php). The file then queries a database( mySQl ) and extracts some info and displays it. So the script is working as it is.

I need help in calling this php script via a flash movie and displaying the content extracted from the database in a dynamic text field in the movie. To view the movie, please click on this link:
The white rectangular field in the movie is the dynamic text box.
 
I have successfully used loadVariable with a cgi script...

Example:
loadVariables(" TextBox);

The cgi script essentially reads the file and spews the output of the file into the variable with the loadVariables command. The "TextBox" is the actually movieclip name that the text would go into.

Here is one link for the loadVariable syntax.


Hope this helps...

Aaron
 
First, make your php script echo out the variable for use in your flash flick. An example would be if $hit was your php variable, and bit was to be your flash variable. So your line of code would be:

echo "&bit=".$hit."&";

Next use LoadVars to load your variables from the php file.

var c = new LoadVars();
c.onLoad = showValues;
c.load("test.php");
function showValues() {
yourdynamictxtbox.text = c.bit;
}

Hope this helps.
 
darylclassen,
My forms are html and to call my php script this is how I am calling it:
<form action=&quot;events.php&quot; method=&quot;post&quot;>
<table>
<?php
echo &quot;<INPUT TYPE=HIDDEN NAME=player VALUE='$player'>&quot;;
?>
<tr>
<td>
<input align=&quot;center&quot; size=&quot;50&quot; type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;OK&quot;>
</td>
</tr>
</table>
</form>
To call my flash movie I did the same thing:
So the form action=&quot;SEMESTER.swf&quot; and then the movie calls events.php. Is this the right way to do it? Or do I need everything in flash?
Thanks
 
Hi Guys,

The main thing with accessing php files is that they must be accessed via a webserver for the php file to be actuated,[converted into html] i.e call should be to and not just to mytestphp.php.

Regards kiwiJor

Merry Xmas to all.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top