文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>SWFObject推出2.0版本了

SWFObject推出2.0版本了

时间:2008-06-02  来源:hakulamatata

SWFObject推出2.0版本了,并在code.google.com上建立了开源项目[http://code.google.com/p/swfobject/]。
    SWFObject是简单易用的Flash嵌入和检测JS代码,个人觉得比Adobe官方提供要更为方便,也更为易用的。这次版本更新改动非常大。
    SWFObject2.0现提供两个主要调用方法。
       1.swfobject.registerObject(flashContentId, flashVersion,expressInstallUrl );
         flashContentId为Flash的ID;
         flashVersion为播放SWF的Player版本;
         expressInstallUrl为Flash Player更新安装的swf调用地址;如果当前版本低于flashVersion将自动更新。
view plaincopy to clipboardprint?
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">  
  2. <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">  
  3. <head>  
  4. <title>SWFObject v2.0 sample page</title>  
  5. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />  
  6. <script type="text/javascript" src="swfobject.js"></script>  
  7. <script type="text/javascript">  
  8. swfobject.registerObject("myId", "9.0.0", "expressInstall.swf");   
  9. </script>  
  10. </head>  
  11. <body>  
  12. <div>    
  13. <object id="myId" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="300" height="120">  
  14. <param name="movie" value="test.swf" />  
  15. <!--[if !IE]>-->  
  16. <object type="application/x-shockwave-flash" data="test.swf" width="300" height="120">  
  17. <!--<![endif]-->  
  18. <div>  
  19. <h1>Alternative content</h1>  
  20. <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>  
  21. </div>  
  22. <!--[if !IE]>-->  
  23. </object>  
  24. <!--<![endif]-->  
  25. </object>  
  26. </div>  
  27. </body>  
  28. </html>  
<!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 v2.0 sample page</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> </head> <body> <div> <object id="myId" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="300" height="120"> <param name="movie" value="test.swf" /> <!--[if !IE]>--> <object type="application/x-shockwave-flash" data="test.swf" width="300" height="120"> <!--<![endif]--> <div> <h1>Alternative content</h1> <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> </div> </body> </html>
       2.swfobject.embedSWF(swfUrl, replaceElementId, swfWidth, swfHeight, flashVersion,expressInstallUrl, flashvars, params, attributes);
         swfUrl为调用swf的地址;
         replaceElementId为要用于替换成flash的可显示容器的ID;
         swfWidth为swf的宽度;
         swfHeight为swf的高度;
         flashVersion为播放SWF的Player版本;
         expressInstallUrl为Flash Player更新安装的swf调用地址;如果当前版本低于flashVersion将自动更新。
         flashvars为flashvars传递的变量值;
         params为flash player控件的参数设置;如menu="false" ;
         attributes为flash player控件的属性值设置;如class="flashstyle";
view plaincopy to clipboardprint?
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">  
  2. <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">  
  3. <head>  
  4. <title>demo</title>  
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  
  6. <script type="text/javascript" src="swfobject.js"></script>  
  7. <script type="text/javascript">  
  8. var flashvars = {};   
  9. flashvars.sn = "a00001";   
  10. var params = {};   
  11. params.menu = "false";   
  12. params.quality = "autohigh";   
  13. params.wmode = "opaque";   
  14. params.allowfullscreen = "true";   
  15. params.allowscriptaccess = "always";   
  16. params.allownetworking = "all";   
  17. var attributes = {};   
  18. swfobject.embedSWF("test.swf", "flashcontent", "300", "120", "9.0.0", "expressInstall.swf", flashvars, params, attributes);   
  19. </script>  
  20. </head>  
  21. <body>  
  22. <div id="flashcontent">  
  23. <a href="http://www.adobe.com/go/getflashplayer">    
  24. <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" border="0" />  
  25. </a>    
  26. </div>  
  27. </body>  
  28. </html>  
<!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>demo</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body> <div id="flashcontent"> <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" border="0" /> </a> </div> </body> </html>
SWFObject下载包:http://swfobject.googlecode.com/files/swfobject_2_0.zip
SWFObject的html生成器:http://swfobject.googlecode.com/files/swfobject_2_0_generator_1_1_html.zip
SWFObject的官方Blog:http://blog.deconcept.com/swfobject/
相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载