开发者

Javascript querystring parameter flashvar with swfobject

With javascript functions in the head section of a webpage, I've been able to parse the querystring and send that as a flashvar to an swf, constructing the object embed with one of the JS functions like so:

...

function writeFlash() {
 var width = '1024'
 var height = '500'
 var src = 'j.swf'
 var queries = 'im='+QueryString('im')+'.jpg'
 var l1 = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="'+width+'" height="'+height+'">;'
 var l2 = '<param name="movie" value="'+src+'" />;'
 var l6 = '<param name="flashvars" value="'+queries+'" />;'
 var l3 = '<param name="quality" value="high" />;'
 var l4 = '<embed src="'+src+queries+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'"></embed>;'
 var l5 = '</object>'
 document.write(l1+l2+l6+l3+l4+l5)
}

....

In the body of the page, I call that function to open the swf like this.

...

<script language="JavaScript" type="text/javascript">
<!-- 
writeFlash();
-->
</script> 

...

I'm tring to use SWFobject instead (which I am also开发者_高级运维 using somewhere else to load JW player). When I try to translate my embed to swfobject code I don't manage to shuffle the flashvar through in multiple ways I've tried, please help.


But why do that when in flash you can just do ExternalInterface.call("eval", "document.location.search")

Also don't do with swfobject. Look static publishing which is much cleaner and better for new browsers.

Here is an example of that:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
  <head>
    <title>SWFObject - step 3</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <script type="text/javascript" src="swfobject.js"></script>

    <script type="text/javascript">
    swfobject.registerObject("myId", "9.0.115", "expressInstall.swf");
    </script>
  </head>
  <body>
    <div>
      <object id="myId" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="780" height="420">
        <param name="movie" value="myContent.swf" />
        <!--[if !IE]>-->
        <object type="application/x-shockwave-flash" data="myContent.swf" width="780" height="420">
        <!--<![endif]-->
          <p>Alternative content</p>
        <!--[if !IE]>-->
        </object>
        <!--<![endif]-->
      </object>
    </div>
  </body>
</html>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜