Adobe Flash Actionscript Flex Examples

Flash LoadVars With PHP Basic Example

JavaScript and the latest version of the Adobe Flash Player are required. If you are you using a browser with JavaScript disabled please enable it now. Otherwise, please update your version of the free Flash Player by downloading here.

This is a basic example of using LoadVars to load variables from a PHP script and based on the success or failure select different content for the user to see.

Files are configured to publish the TestLoadVars movie and its html file in the same folder on your PHP web server and to launch using http://www.yourphpserver.___/path_to_TestLoadVars.html/TestLoadVars.html.

If you want to test inside of the Flash IDE, then you need to change the last lines in frame 1 of TestLoadVars.fla to include http://www.yourphpserver.___/path_to_TestLoadVars.php/TestLoadVars.php. There are comments in TestLoadVars.fla for this.

Key item to remember is that anything outside the PHP tags in TestLoadVars.php is returned and this is received by LoadVars. So no whitespace (tabs, spaces, returns characters of any type) outside of the PHP tags.

Downloads:
All source files for Flash MX2004: Download
All source files for Flash 8: Download
Search For More Flash Flex Actionscript Examples