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
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>";
    }
  }

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.