PDA

View Full Version : Getting variable from html-form


dangerclaes
04-23-2003, 03:42 PM
Hi guys.

I want to load a variable into a swf-file using php.

I've made a form which sends a variable ($var) from a html-file to a document called flash.php which consists of a swf, a bit of html and a php-code which says:

<?
$output=$var;
print "&output=";
print.=$output;
?>

I want to display the variable in a dynamic text field called "output" onLoad . I just can't figure out, how to put the actionscript together (I guess I should use LoadVars or something...).

Can anyone help me with this?

Thanx a lot

- Claes

jaybee
04-24-2003, 01:32 PM
there are many ways to do this - if you just have one var to put into your movie the easiest may be to add a flashvars attribute the object and embed tags written by php:



// object tag
<PARAM NAME=FlashVars VALUE="object=<?=$object ?>">

// embed tag

<EMBED src="myswf.swf" FlashVars="object=<?=$object ?>" ... (other parameters)> </EMBED>



the alternative, if you have more data to get into the movie, is to use LoadVars or XML, but this is the easiest,

jaybee
04-24-2003, 01:34 PM
BTW, the variable *object* will then be available on main timeline

dangerclaes
04-24-2003, 02:10 PM
Thanx jaybee.

That sounds neat. I'll try it. :p

But for this project I need to load four variables, so I guess I should use the loadvars. I just can't figure out how to write it.

-CLAES

jaybee
04-24-2003, 02:28 PM
check out the tute on this site - it will help you