FlashVars Not Working But Query String Is

250 Views Asked by At

Some advise please.

I have a FLA in CS5 using AS3 and I can get Query String to work to pass variables but not FlashVars (I am not trying to use them both at the same time).

I have HTML below that adds the SWF:

<!-- Extract from http://www.[domain]/flash.html -->
    <div id="flashContent">
        <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="700" height="600" id="SWF" align="middle">
            <param name="movie" value="http://[subdomain].[domain]/swf.swf?var1=var1value"> <!-- This is working -->
            <param name="FlashVars" value="var1=var1value"> <!-- This is NOT working -->
            <param name="quality" value="high">
            <param name="bgcolor" value="#ffffff">
            <param name="play" value="true">
            <param name="loop" value="true">
            <param name="wmode" value="window">
            <param name="scale" value="showall">
            <param name="menu" value="true">
            <param name="devicefont" value="false">
            <param name="salign" value="">
            <param name="allowScriptAccess" value="sameDomain">
            <!--[if !IE]>-->
            <object type="application/x-shockwave-flash" data="http://[subdomain].[domain]/swf.swf?var1=var1value" width="700" height="600">
                <param name="movie" value="http://[subdomain].[domain]/swf.swf?var1=var1value"> <!-- This is working -->
                <param name="FlashVars" value="var1=var1value"> <!-- This is NOT working -->
                <param name="quality" value="high">
                <param name="bgcolor" value="#ffffff">
                <param name="play" value="true">
                <param name="loop" value="true">
                <param name="wmode" value="window">
                <param name="scale" value="showall">
                <param name="menu" value="true">
                <param name="devicefont" value="false">
                <param name="salign" value="">
                <param name="allowScriptAccess" value="sameDomain">
            <!--<![endif]-->
                <a href="http://www.adobe.com/go/getflash">
                    <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player">
                </a>
            <!--[if !IE]>-->
            </object>
            <!--<![endif]-->
        </object>
    </div>

In the FLA I have the following:

   try {
        flashVars = LoaderInfo(this.root.loaderInfo).parameters;
    }catch (error:Error) {
        errorBox.appendText(error.toString());
    }

I then use the passed information by using:

flashVars.var1;

As noted in the comments in the HTML <param name="movie" value="http://[subdomain].[domain]/swf.swf?var1=var1value"> works but <param name="FlashVars" value="var1=var1value"> does not.

My understanding is that <param name="FlashVars" value="var1=var1value"> is considered better practise. Is this the case and why, but more importantly can anyone tell me why it is not working?

0

There are 0 best solutions below