清风明月

类别



友情链接

回复更新

计数器

日历

谈谈新浪网体育新闻中的SWF用法

Author: PublishTime:2006-3-27

这个SWF通过网页的Javascript获得变量名,在网页中通过“FlashVar”向SWF文件传送变量,这样SWF

 才获得图片地址,图片文字说明和链接地址,以及场景大小。文件中共有21种遮照效果,都用AS实现遮照的。

分析html源文件中可见:( 看效果http://zhydlzr.go.51.net/abcde.html        )

<script type=text/javascript>
 <!--
 var focus_width=370     //场景宽
 var focus_height=270  //场景高
 var text_height=26   //文字说明字高,为0时不显示文本
 var swf_height = focus_height+text_height
 
 
var pics='http://zhydlzr.go.51.net/image/jpg/jpg0.jpg|http://zhydlzr.go.51.net/image/jpg/jpg1.jpg|http://zhydlzr.go.51.net/image/jpg/jpg2.jpg|http://zhydlzr.go.51.net/image/jpg/jpg3.jpg|http://zhydlzr.go.51.net/image/jpg/jpg4.jpg|http://zhydlzr.go.51.net/image/jpg/jpg5.jpg'

var links='http://www.flash8.net|http://bbs.flash8.net|http://bbs.flash8.net|http://bbs.flash8.net|http://bbs.flash8.net|http://bbs.flash8.net'

var texts='这是我加的第一张图片|第二张|第三张|第四张|第五张图片|第6张图片'

//以上三个变量是说明图片地址,每张图片的链接地址及说明,图片的张数也在这里体现,中间用|隔开。 
 document.write('<object ID="focus_flash" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+ focus_width +'" height="'+ swf_height +'">');
 document.write('<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="abcde.swf"><param name="quality" value="high"><param name="bgcolor" value="#E7E7E7">');
 document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
 document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'">');
 document.write('<embed ID="focus_flash" src="abcde.swf" wmode="opaque" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'" menu="false" bgcolor="#E7E7E7" quality="high" width="'+ focus_width +'" height="'+ focus_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"/>');  document.write('</object>');

       //--></script>

如果要用这个效果的话,只须在上面红色部色更改,abcde.swf在附件中提供

将代码写入html中,就行了。

分类于:flash

Comments

{CommentAuthor} at {CommentTime} | {CommentEmail} {CommentUrl} {CommentIp}
{CommentContent}
Powered by 5DBlog.com