网上看到很多次FLASH广告系统,如下图。看上去蛮不错的,也想找个来试试,找处找源码,可惜没找到,不过我发现如果你不要改动什么的话直接从有这个广告系统在用的网站上下载swf就行了。
uploads/200602/24_112320_adpic.jpg



废话不多说了,分享一下使用方法

原理:使用javascript和FALSH进行数据交换
文件:一个调用FLASH和含有JAVASCRIPT的html文件+一个广告FLASH文件

html文件主要代码:
<script type=text/javascript>
  <!--
  var focus_width=365
  var focus_height=420
  var text_height=0
  var swf_height = focus_height+text_height
      
var pics='http://www.pconline.com.cn/test/toptitle/images/picpath/pmareddian365.jpg|http://www.pconline.com.cn/test/toptitle/images/picpath/jiadian(2).JPG|http://www.pconline.com.cn/test/toptitle/images/picpath/02232yuejiangkpfoc.jpg'

var links='http://www.pconline.com.cn/digital/dc/news/cmt/0602/760853.html|http://www.pconline.com.cn/digital/family/|http://www.pconline.com.cn/digital/audio/daogou/mp3/time/0602/760219.html'

var texts='DC|家电|随身听'

  
  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=6,0,0,0" width="'+ focus_width +'" height="'+ swf_height +'">');
  document.write('<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="pixviewer.swf"><param name="quality" value="high"><param name="bgcolor" value="#E7E7E7">');
  document.write('<param name="menu" value="false"><param name=wmode value="transparent">');
  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="pixviewer.swf" wmode="transparent" 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>

focus_width  用来设置FLASH宽度
focus_height  用来设置FLASH高度
text_height  设置显示字体区域高度(字会显示在FLASH最下面,如果是0就不显示)
pics      设置加载图片的地址,中间以“|”分隔
links      设置加载图片链接的地址,中间以“|”分隔
texts     设置加载图片说明文字的地址,中间以“|”分隔,如果text_height设置是0的话就不会显示

FLASH文件和示例HTML的下载:
点此下载

08Design还有一种形式的广告,效果见:http://auto.sohu.com/
FLASH文件和示例HTML的下载:
点此下载
posted on 2007-02-27 13:59  mbskys  阅读(727)  评论(0)    收藏  举报