转:享受 Bcastr 4.0,优秀的通用图片轮换播放器~~


特别提示:xml 是可以动态生成的,但是在生成的时候要着重考虑 bcastr4.swf 、bcastr.xml 以及 图片的路径关系,另外需要注意 flash新版本 是不能跨域的,flash里面的链接和图片都是不能跨域的,就是说你的xml里面的的图片和链接地址都要跟xml是属于一个域名的~~

网友冰淇淋小子建议:参数里面的图片和链接地址最好使用绝对路径。

我们在进行网页编程时,难免会遇到需要进行图片轮换的地方,在这里向大家推荐 Bcastr 4.0 ,一款优秀的通用图片轮换播放器。使用 Bcastr 4.0 可以轻松的制作如上面所示的图片轮换效果,它有如下的特点:

  • 可以读取xml设置播放列表,自定义xml地址
  • 可以将图片地址直接写网页中直接,不需要xml
  • 自动适应图片大小
  • 循环播放,自定义自动播放时间
  • 不限制图片数量
  • 自定义尺寸,自动适应任何比例,图片不变形
  • 自定义图片题目(可选)
  • 浏览过程中下载
  • 自定义图片连接(可选)
  • 自定界面色彩放案

插入代码

Bcastr 4.0提供直接写入参数和使用xml传递参数两种代码插入的办法:

1.直接写入参数

<object type="application/x-shockwave-flash" data="http://xiaogui.org/files/bcastr/bcastr4.swf?xml=
   <data>
    <channel>
     <item>
      <link>http://xiaogui.org/visual-studio-2010-msdn-chinese-simplified-version.html</link>
         <image>http://xiaogui.org/files/2010-05/home-hero-boxshot.jpg</image>
         <title>Visual Studio 2010 MSDN中文版下载</title>
        </item>
        <item>
         <link>http://xiaogui.org/province-city-area-selector.html</link>
         <image>http://xiaogui.org/files/2010-05/province-city-area-selector.png</image>
         <title>PCAS省、市、地区联动选择JS封装类</title>
        </item>
        <item>
         <link>http://xiaogui.org/foxit-reader-3-3.html</link>
         <image>http://xiaogui.org/files/2010-05/foxit-reader-3-3.png</image>
         <title>福昕PDF阅读器(Foxit Reader)3.3 正式发布</title>
        </item>
        <item>
         <link>http://xiaogui.org/visual-studio-2010-express-version.html</link>
         <image>http://xiaogui.org/files/2010-06/sl_VSE2010.png</image>
         <title>Visual Studio 2010 Express 版提供下载</title>
        </item>
        <item>
         <link>http://xiaogui.org/expression-studio-4-release.html</link>
         <image>http://xiaogui.org/files/2010-06/expression-studio-4-release.png</image>
         <title>微软设计套装 Expression Studio 4 正式版发布</title>
        </item>
       </channel>
   </data>
  "  width="500" height="150">
  <param name="movie" value="http://xiaogui.org/files/bcastr/bcastr4.swf?xml=
   <data>
        <channel>
          <item>
            <link>http://xiaogui.org/visual-studio-2010-msdn-chinese-simplified-version.html</link>
            <image>http://xiaogui.org/files/2010-05/home-hero-boxshot.jpg</image>
            <title>Visual Studio 2010 MSDN中文版下载</title>
          </item>
          <item>
            <link>http://xiaogui.org/province-city-area-selector.html</link>
            <image>http://xiaogui.org/files/2010-05/province-city-area-selector.png</image>
            <title>PCAS省、市、地区联动选择JS封装类</title>
          </item>
          <item>
            <link>http://xiaogui.org/foxit-reader-3-3.html</link>
            <image>http://xiaogui.org/files/2010-05/foxit-reader-3-3.png</image>
            <title>福昕PDF阅读器(Foxit Reader)3.3 正式发布</title>
          </item>
          <item>
            <link>http://xiaogui.org/visual-studio-2010-express-version.html</link>
            <image>http://xiaogui.org/files/2010-06/sl_VSE2010.png</image>
            <title>Visual Studio 2010 Express 版提供下载</title>
          </item>
          <item>
            <link>http://xiaogui.org/expression-studio-4-release.html</link>
            <image>http://xiaogui.org/files/2010-06/expression-studio-4-release.png</image>
            <title>微软设计套装 Expression Studio 4 正式版发布</title>
          </item>
        </channel>
   </data>" />
 </object> 

2.使用xml传递参数

<object id="bcastr4" data="http://xiaogui.org/files/bcastr/bcastr4.swf?xml=http://xiaogui.org/files/bcastr/bcastr.xml" type="application/x-shockwave-flash" width="500" height="150">
        <param name="movie" value="http://xiaogui.org/files/bcastr/bcastr4.swf?xml=http://xiaogui.org/files/bcastr/bcastr.xml" />
</object>

xml文件内容:

<?xml version="1.0" encoding="utf-8"?>
<data>
 <channel>
  <item>
   <link>http://xiaogui.org/visual-studio-2010-msdn-chinese-simplified-version.html</link>
   <image>http://xiaogui.org/files/2010-05/home-hero-boxshot.jpg</image>
   <title>Visual Studio 2010 MSDN中文版下载</title>
  </item>
  <item>
   <link>http://xiaogui.org/province-city-area-selector.html</link>
   <image>http://xiaogui.org/files/2010-05/province-city-area-selector.png</image>
   <title>PCAS省、市、地区联动选择JS封装类</title>
  </item>
  <item>
   <link>http://xiaogui.org/foxit-reader-3-3.html</link>
   <image>http://xiaogui.org/files/2010-05/foxit-reader-3-3.png</image>
   <title>福昕PDF阅读器(Foxit Reader)3.3 正式发布</title>
  </item>
  <item>
   <link>http://xiaogui.org/visual-studio-2010-express-version.html</link>
   <image>http://xiaogui.org/files/2010-06/sl_VSE2010.png</image>
   <title>Visual Studio 2010 Express 版提供下载</title>
  </item>
  <item>
   <link>http://xiaogui.org/expression-studio-4-release.html</link>
   <image>http://xiaogui.org/files/2010-06/expression-studio-4-release.png</image>
   <title>微软设计套装 Expression Studio 4 正式版发布</title>
  </item>
 </channel>
 <config>
  <roundCorner>0</roundCorner>
  <autoPlayTime>8</autoPlayTime>
  <isHeightQuality>false</isHeightQuality>
  <blendMode>normal</blendMode>
  <transDuration>1</transDuration>
  <windowOpen>_blank</windowOpen>
  <btnSetMargin>auto 5 5 auto</btnSetMargin>
  <btnDistance>20</btnDistance>
  <titleBgColor>0xff6600</titleBgColor>
  <titleTextColor>0xffffff</titleTextColor>
  <titleBgAlpha>.75</titleBgAlpha>
  <titleMoveDuration>1</titleMoveDuration>
  <btnAlpha>.7</btnAlpha>
  <btnTextColor>0xffffff</btnTextColor>
  <btnDefaultColor>0x1B3433</btnDefaultColor>
  <btnHoverColor>0xff9900</btnHoverColor>
  <btnFocusColor>0xff6600</btnFocusColor>
  <changImageMode>click</changImageMode>
  <isShowBtn>true</isShowBtn>
  <isShowTitle>true</isShowTitle>
  <scaleMode>noBorder</scaleMode>
  <transform>blur</transform>
  <isShowAbout>true</isShowAbout>
  <titleFont>微软雅黑</titleFont>
 </config>
</data>

参数说明

从上面的xml可以看出Bcastr 4.0 可以设置很多参数,下面就对这些参数和它的默认值进行简单的说明:

影片信息
channel.item 图片信息,可以设置多张图片
channel.itme.image 图片地址参数,此参数是唯一必须要有的参数,其他参数都有默认参数
channel.itme.link 对应图片的连接
channel.itme.tilte 对应图片的标题

设置
config.roundCorner 图片的圆角
config.autoPlayTime 图片切换时间,默认值是8,单位秒
config.isHeightQuality 图片缩小是否采用高质量的方法,默认值false
config.normal 图片的混合模式
config.transDuration 图片在切换过程中的时间,默认值1,单位秒
config.windowOpen 图片连接的打开方式,默认值”_blank”,在新窗口打开,也可以使用”_self”,使用本窗口打开
config.btnSetMargin 按钮的位置,文字的位置,用了css的margin概念,默认值”auto 5 5 auto”,四个数值代表 上 右 下 左 相对于播放器的距离,四个数值用空格分开,不需具体数值用”auto”填写 ,比如左上对齐并都有10像素的距离可以写 “10 auto auto 10″, 右下角对齐是”auto 10 10 auto”
config.btnDistance 每个按钮的距离,默认值20
config.titleBgColor 标题背景的颜色,默认0xff6600
config.titleTextColor 标题文字的颜色,默认0xffffff
config.titleBgAlpha 标题背景的透明度,默认0.75
config.titleFont 标题文字的字体,默认值”微软雅黑”
config.titleMoveDuration 标题背景动画的时间,默认值1,单位秒
config.btnAlpha 按钮的透明度,默认值0.7
config.btnTextColor 按钮文字的颜色,默认值0xffffff
config.btnDefaultColor 按钮的默认颜色,默认值0×1B3433
config.btnHoverColor 按钮的默认颜色,默认值0xff9900
config.btnFocusColor 按钮当前颜色,默认值0xff6600
config.changImageMode 切换图片的方法,默认值”click”,点击切换图片,还可以使用”hover”,鼠标悬停就切换图片
config.isShowBtn 是否显示按钮,默认值”true”
config.isShowTitle 是否显示标题,默认值”true”
config.scaleMode 图片放缩模式: 默认值是”noBorder”
“showAll”: 可以看到全部图片,保持比例,可能上下或者左右
“exactFil”: 放缩图片到舞台的尺寸,可能比例失调
“noScale”: 图片的原始尺寸,无放缩
“noBorder”: 图片充满播放器,保持比例,可能会被裁剪
config.transform 图片放缩模式: 默认值是”alpha”
“alpha”: 透明度淡入淡出
“blur”: 模糊淡入淡出
“left”: 左方图片滚动
“right”: 右方图片滚动
“top”: 上方图片滚动
“bottom”: 下方图片滚动
“breathe”: 有一点点地放缩的淡入淡出
“breatheBlur”: 有一点点地放缩的模糊淡入淡出,本页的例子就是这个
config.isShowAbout 是否显示关于信息,默认值”true”

下载

实例:http://bcastr.googlecode.com/svn/trunk/bcastr4/release/example/example.zip

源代码:http://bcastr.googlecode.com/svn/trunk/bcastr4/release/src.zip

意见和反馈

上面的例子,在插入Flash的时候使用的是《符合w3c标准flash(swf)插入代码,常用flash参数设置》中的方法,你也可以结合《SWFObject,独立、简捷、安全的Flash媒体版本检测与嵌入模块》,对上面的代码进行完善。在你使用Bcastr 4.0 的过程中,如果遇到什么问题,请在下面留言。


  


posted @ 2011-09-23 15:40  魔豆  阅读(3671)  评论(2编辑  收藏  举报