flashactionscript-3actionscriptflashvars

Flashvars won't load


I've got a weird problem with loading Flashvars into my flash application. I tried to isolate the code and try it in an other document, but the object returned is still empty.

This is my HTML code:

<div id="Div1">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="630" height="671" id="testApp" align="middle">
    <param name="movie" value="{$this->siteUrl}/flash/testVars.swf" />
    <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="FlashVars" value="one=1&two=2" />
    <param name="devicefont" value="false" />
    <param name="salign" value="" />
    <param name="allowScriptAccess" value="always" />
    <!--[if !IE]>-->
    <object type="application/x-shockwave-flash" data="{$this->siteUrl}/flash/testVars.swf" width="630" height="671">
        <param name="movie" value="{$this->siteUrl}/flash/testVars.swf" />
        <param name="quality" value="high" />
        <param name="bgcolor" value="#ffffff" />
        <param name="play" value="true" />
        <param name="loop" value="true" />
        <param name="FlashVars" value="one=1&two=2" />
        <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="always" />
    <!--<![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>

This is my as3 code:

ExternalInterface.call('console.log', "Begin")
var obj:Object = this.loaderInfo.parameters;
for(var i:String in obj)
{
    this[i] = obj[i];
    ExternalInterface.call('console.log', "Parsing: " + i + " - " + obj[i])
}

It show begin nicely in the console window of Chrome, but it does not print the flashvars. Can you tell me what I'm doing wrong?

Thanks!


Solution

  • Ok, so this is a 'bug' in Flash with the TLF Text component. Including a TLF Text element within your document also includes the Text Layout Framework Runtime Shared Library (TLF RSL). The RSL prepends a preloader before your main movie

    This means that your swf is no longer the first movie loaded and so it renders the FlashVars unaccesable.

    Adrian Parr has an exelent blog item about this: http://www.adrianparr.com/?p=137