Jump to content

PHP and Flash Sending Variables


xlxprophetxlx

Recommended Posts

Hello everyone,

 

I have a little problem.  What I am trying to accomplish is sending variables from Flash to PHP.  What I need to happen is when I click a button in Flash it will send a variable out to the PH to change the HTML on the page.  I tried using a query string...it works but it reloads the page which shouldn't happen.  I am trying to avoid using a query string if possible.  I was thinking LoadVars would work but I can't seem to get it.

 

Similar to this:

 

PHP index.php page:

 

<?php
if ($ruins = "ruins"){
echo "<p>WORKED!!!</p>";
}else{
echo "<p>Doesn't Work</p>";
};
?>

 

Flash Button:

function aboutfunction() {
if (_global.sceneframe == "ruins") {
	_root.loader_mc.loadMovie("aboutus.swf");
		var ruins:String = "ruins";
		getURL("index.php?ruins="+ruins);			
} else {
	startPreload("transition.swf");
	_global.sceneframe = "ruins";
	var ruins:String = "ruins";
		getURL("index.php?ruins="+ruins);	
}
}
nav.nav_about.onRelease = aboutfunction;

 

The code above uses a query sting but like I said I would like to avoid using a query string.

 

Any steps in the right direction would be helpful.

 

Thanks,

 

-Mike

Link to comment
https://forums.phpfreaks.com/topic/88253-php-and-flash-sending-variables/
Share on other sites

What I need to happen is when I click a button in Flash it will send a variable out to the PH to change the HTML on the page.  I tried using a query string...it works but it reloads the page which shouldn't happen.

 

If you want the html on the page changed it will need to be reloaded. Unless you plan on using some ajax.

 

Otherwise, you are correct, LoadVars will do what you want.

 

Your php is fubar however....

 

<?php
  
  if (isset($_GET['ruins'])) {
    if ($_GET['ruins'] == "ruins") {
      echo "<p>WORKED!!!</p>";
    } else {
      echo "<p>Doesn't Work</p>";
    }
  }

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.