Hi,
I have created a flash file that requires variables from the HTML page it is embedded in. Now I'm not sure wether this is a Flash problem or a HTML problem but when I view the flash file through the web page with the following embed code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>uTutorial Uploader V 1.3</title>
<script src="Scripts/swfobject_modified.js" type="text/javascript"></script>
</head>

<body>
<center>
<p>
  <object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="380" height="130">
    <param name="movie" value="flash/arcs.swf?testing=test" />
    <param name="quality" value="high" />
    <param name="wmode" value="opaque" />
    <param name="swfversion" value="9.0.45.0" />
    <!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. -->
    <param name="expressinstall" value="Scripts/expressInstall.swf" />
    <!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
    <!--[if !IE]>-->
    <object type="application/x-shockwave-flash" data="flash/arcs.swf?testing=test" width="380" height="130">
      <!--<![endif]-->
      <param name="quality" value="high" />
      <param name="wmode" value="opaque" />
      <param name="swfversion" value="9.0.45.0" />
      <param name="expressinstall" value="Scripts/expressInstall.swf" />
      <!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
      <div>
        <h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
        <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>
      </div>
      <!--[if !IE]>-->
    </object>
    <!--<![endif]-->
  </object>
</p>
<h6><a href="/browser.php?Do=<?php echo $_GET['Do']; ?>">Switch To Browser Uploader</a> (Older Browsers or No Flash)</h6>
<script type="text/javascript">
<!--
swfobject.registerObject("FlashID");
//-->
</script>
</center>
</body>
</html>

The variables are not passed through to the file, however when I open /flash/arcs.swf?testing=test in its own browser window it works fine. The code in AS3 for getting the variables is

function getqry(myEvent:Event)
{
  var myQueryStrings=this.loaderInfo.parameters;
  status_txt.text=myQueryStrings.testing;
}
this.loaderInfo.addEventListener(Event.COMPLETE, getqry);

Regards,
Sam Rudge

I can't see anything obvious...

The only thing I can think of that you could try is perhaps removing your variables from the flash movies URL..
i.e. change the following lines:

<param name="movie" value="flash/arcs.swf?testing=test" />

to

<param name="movie" value="flash/arcs.swf" />

and

<object type="application/x-shockwave-flash" data="flash/arcs.swf?testing=test" width="380" height="130">

to

<object type="application/x-shockwave-flash" data="flash/arcs.swf" width="380" height="130">

Then, where you have your <param name> tags try adding the following line....

<param name="flashvars" value="Testing=Test" />

Note: It looks to me like you'll need to put two copies of the above line in your code. One under the first line you edited and another a couple of lines below the second edited line! (because it's in the middle of your !IE thing!)

It's the only method I've ever used to pass variables into flash, so it should work....Let me know how you get on!
I've never used the old querystring method of passing params before, so I don't know much about it!

Addendum:
If memory serves, using flashvars makes the parameters available to the root of the movie, so your getqry method will probably be redundant as you won't be using querystring any more!

I know that the flashvars thing isn't the most secure way of sending parameters to a flash file, the only other method I am aware of which I used once (but too long ago for me to remember the specifics of) is FSCommand which I think is more secure...

Cheers for now
Jas.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.