Page is a not externally linkable
- Code, Content, and Presentation
-- Flash and Shockwave
---- Display some text from a php file in a flash movie


rocknbil - 3:08 pm on Apr 15, 2009 (gmt 0)


Note that in both cases, you are loading a variable.

So whether it's a text file, perl or PHP, Flash is expecting a variable, not just page output. Try something like this for the php script:

echo "var_from_myfile=someinfo";

Better yet, combine your (painful!) efforts with a clean deployment of Flash using SWFObject's addVariable parameter in the PHP output. Normally this is done in a static page, but you can output it dynamically.

Be sure to download and have the SWFObject libary in the specified location:


$swf = '/js/swfobject.js';
$myflash = '/flash/myflash.swf';
$flashwidth=330;
$flashheight=290;
$flashid='unique-id';
$variable_content = 'Hello CRUEL WORLD!';
var $msg ="
<html><head><title>Test</title></head><body>
<div id=\"flash-placeholder\">
This will be REPLACED by your Flash onload.
Use an image $flashwidth x $flashheight.
</div>
<script type=\"text/javascript\" src=\"$swf\"></script>
<script type=\"text/javascript\">
var flashobject = new SWFObject('$myflash', '$flashid', '$flashwidth', '$flashheight', '6', '#ffffff');
flashobject.addParam('wmode', 'transparent');
flashobject.addVariable('var_from_myfile', '$variable_content');
window.onload = function() {
if (document.getElementById('flash-placeholder')) { flashobject.write('flash-placeholder'); }
};
</script>
</body>
</html>
";
header("content-type:text/html\n\n");
echo $msg; # or print $msg;

You may have to fiddle with the quoting, I may have errors there as I just typed it out without testing.

I don't think you'll have to concatenate these

, '.$flashheight.',

because the actual "wrapper" is the double quote which will interpolate the PHP variables, and the single quotes are output for the Javascript.

But this will work, and probably with either example above or the simplest sample in the Flash help files using loadVariables or even getURL().


Thread source:: http://www.webmasterworld.com/flash/3892100.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com