ecshop 更新首页flash样式

未测试

ECSHOP默认的只有几种很普通的FLASH图片切换样式,想不想自己也换一种呢?
今天摸索了下,算是弄懂了,和大家分享下
首先在网上找到你想要的FLASH切换样式【google一下】,把那个SWF文件拷过来
1.首页FLASH样式放在data\flashdata\下,文件夹DEFAULT的即为默认样式,打开它你会发现里面有bcastr.swf【用于FLASH展示时的FLASH背景】  cycle_image.js【这个JS文件在页面中写入FLASH】 data.js【这个是调用图片数据文件】 preview.jpg【这个是在后台中的FLASH样式预览图】几个文件
2.现在你可以新建一个文件夹,名字随便,我们取为Demo
然后把DEFAULT里的除了bcastr.swf 和preview.jpg其他文件都拷进来,把你在网上找的那个SWF样式文件拷进来,重命名为bcastr.swf 预览图preview.jpg自己可以随便放一张
现在到后台看下首页广告管理,是否多出了你自己添加的样式呢?我添加的样式是北京2008的样式

3.然后在后台添加自己想要的图片即可,前台刷新,OK。
======================================================================
我们来分析下文件吧。
/*
Flash Name: 2008beijing //在后台预览中会看到的
Description: 北京2008主题
*/
document.write('<div id="flash_cycle_image"></div>'); //写入ID为flash_cycle_image的层
$importjs = (function()
{
    var uid = 0;
    var curr = 0;
    var remove = function(id)
    {
        var head = document.getElementsByTagName('head')[0];
        head.removeChild( document.getElementById('jsInclude_'+id) );
    };
    return function(file,callback)
    {
        var callback;
        var id = ++uid;
        var head = document.getElementsByTagName('head')[0];
        var js = document.createElement('script');
        js.setAttribute('type','text/javascript');
        js.setAttribute('src',file);
        js.setAttribute('id','jsInclude_'+id);
        if( document.all )
        {
            js.onreadystatechange = function()
            {
                if(/(complete|loaded)/.test(this.readyState))
                {
                    try
                    {
                        callback(id);remove(id);
                    }
                    catch(e)
                    {
                        setTimeout(function(){remove(id);include_js(file,callback)},2000);
                    }
                }
            };
        }
        else
        {
            js.onload = function(){callback(id); remove(id); };
        }
        head.appendChild(js);
        return uid;
    };
}
)();
function show_flash()    //写出FLASH函数
{
    var text_height = 0; 
    var focus_width = swf_width; //宽
    var focus_height = swf_height - text_height; //高
    var total_height = focus_height + text_height;
    document.getElementById('flash_cycle_image').innerHTML = '<object 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="'+ total_height +'">'+'<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="data/flashdata/demo/demo.swf"><param name="quality" value="high"><param name="bgcolor" value="#F0F0F0">'+'<param name="menu" value="false"><param name=wmode value="opaque">'+'<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'">'+'<embed src="data/flashdata/demo/demo.swf"FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'" quality="high" width="'+ focus_width +'" height="'+ total_height +'"allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent"/>'+'</object>';
}
$importjs('data/flashdata/demo/data.js', show_flash);       //调用data.js文件调出动态图片

 

posted on 2013-07-10 23:14  unifyyeteng  阅读(469)  评论(0编辑  收藏  举报

导航