广州传奇网络

地址:广州市天河区东圃大马路富华楼C座

电话:13808825895

邮箱:gz020wbs@163.com

QQ:1564443073

网址:http://www.020wbs.com/

首页 > 二次开发Ecshop二次开发 > ecshop如何diy首页flash图片切换样式

二次开发Ecshop二次开发

二次开发Ecshop二次开发

ecshop如何diy首页flash图片切换样式

FLASH图片切换样式只有ecshop默认的几种,大家一定有自己喜欢的flash样式吧?如果能把自己喜欢的样式放到自己的网站上效果一定很新颖,现在就告诉大家这个flash样式diy的做法。

1.找到flash图片切换样式存放的位置data\flashdata\这里有默认样式DEFAULT,打开默认样式我们可以找到控制flash展示的选项:flash展示背景,调用图片数据,flash样式预览图,在页面中写入flash的文件cycle_image.js。
2.命名一个文件夹叫做Demo,然后把cycle_image.js和data.js(调用图片数据文件)这两个文件拷贝到新建的文件里,把自己喜欢的flash的swf格式的文件放到这个文件夹里,并且命名为bcastr.swf,预览图可以任意存放一张即可。

3.现在后台中首页广告管理里面就出现了自己添加的flash样式了,

4.在后台中我们可以添加图片用在FLASH图片切换样式里面了。
后台的代码是这样的:
/*
Flash Name: 自己命名的样式
Description: 样式名称
*/
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://www.ecshopdev.com" 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.ecshopdev.com" wmode="transparent"/>'+'</object>';
}
$importjs('data/flashdata/demo/data.js', show_flash);       //调用data.js文件调出动态图片