Search code examples
javascriptactionscript-3swfobject

reading flashvars problem for swfobject


I have a flash swf of 1.2mb. am embeding it with swfobject using dynamic embeding .

<script type="text/javascript">
var flashvars = {};

flashvars.campaignid = "12345678890";
var params = {};
params.allowscriptaccess = "always";
var attributes = {};
swfobject.embedSWF("soccer.swf", "myAlternativeContent", "550", "400", "10.0.0", false, flashvars, params, attributes);
</script>

am tring to read campaignid inside my document class ...

the code is like

public function Main()
{    
    loaderInfo.addEventListener(ProgressEvent.PROGRESS,update); 
    loaderInfo.addEventListener(Event.COMPLETE,onLoadedMovie); 
}                 
private function update(e:ProgressEvent):void         
{
}

private function onLoadedMovie(e:Event)
{
    campId=this.root.loaderInfo.parameters["campaignid"]; 
}

when i alert the value i got null when i use the same method in a small file it works.. can anyone help me? regards


Solution

  • I got the answer by adding variable in the embed code. like this

    swfobject.embedSWF("soccer.swf?campaignid=1234556"", "myAlternativeContent", "550", "400", "10.0.0", false, flashvars, params, attributes);
    

    Thanks for the help :)