xeno439
04-27-2006, 06:29 PM
I know how to send variables to PHP, but how can I get a variable from PHP and use it's string name in the code? Thanks
smartie_on_computer
04-28-2006, 05:06 AM
bit more descriptive thanks
tenthdeity
04-28-2006, 06:33 AM
I'm pretty sure I know what's going on here, and I'm also pretty sure there's no way to do it.
What Xeno is saying is, it's easy enough to create some actionscript that imports variables from another file, but what about getting and passing variables from the URL of the file that flash is currently embedded in to the file flash is loading?
To clarify with an example:
I have an audio player embedded into a search results page; the player is embedded once for each result row, which contains a link to an mp3 file. Instead of having the user download the mp3 file, it'd be great if the .SWF would just stream the mp3 when clicked.
Let's say my results page is the following URL:
http://www.domain.com/results.php?q=bigego
I have all of the code to pull in another file, "flashvars.inc.php":
loadVarsNum("flashvars.inc.php", 0);
..but flashvars.inc.php expects a variable, "q", which it uses to output the url to the streaming mp3:
<?php
$returnStr = "http://www.domain.com/audio/" . $_GET["q"] . ".mp3";
echo $returnStr;
?>
Obviously, at the current URL if I were to simply include the flashvars.inc.php into the PHP code, it would return the results just fine- but when flash includes files, it would need to pass the existing "$_GET['q']" variable when it calls loadVarsNum().
The ideal situation would be if flash and PHP could merge:
//fake actionscript- "faktionscript?"
loadVarsNum("flashvars.inc.php?q=" . $_GET["q"], 0);
Ignoring the obvious security concerns, is there a way this can be done?
*as an aside, I realize I could simply write out the file when the results page is loaded, but the co-founder Jesse tells us not to do this.
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.