flash 图片翻转效果
老规矩,先看效果:

/* Flash Name: Dynamic Focus Description: 动感聚焦Flash图片轮播 */ document.write(' '); $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() { var button_pos=4; //按扭位置 1左 2右 3上 4下 var stop_time=3000; //图片停留时间(1000为1秒钟) var show_text=1; //是否显示文字标签 1显示 0不显示 var txtcolor="000000"; //文字色 var bgcolor="DDDDDD"; //背景色 var text_height = 18; 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 width="'+ focus_width +'" height="'+ total_height +'" data="flash/dynfocus.swf" type="application/x-shockwave-flash"><param name="quality" value="high" /><param name="wmode" value="opaque" /><param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&pic_width='+focus_width+'&pic_height='+total_height+'&show_text='+show_text+'&txtcolor='+txtcolor+'&bgcolor='+bgcolor+'&button_pos='+button_pos+'&stop_time='+stop_time+'" /><param name="src" value="flash/dynfocus.swf" /><param name="flashvars" value="pics='+pics+'&links='+links+'&texts='+texts+'&pic_width='+focus_width+'&pic_height='+total_height+'&show_text='+show_text+'&txtcolor='+txtcolor+'&bgcolor='+bgcolor+'&button_pos='+button_pos+'&stop_time='+stop_time+'" /></object>'; } $importjs('flash/data.js', show_flash);
OK,这儿是图片地址,链接地址和现实的文字:
imgUrl1="up_files/3.jpg"; imgtext1="$1k NL Hold'em - Double Digits Yo!"; imgLink1=escape("http://"); imgUrl2="up_files/4.jpg"; imgtext2="$1k NL Hold'em - Double Digits Yo!"; imgLink2=escape("#"); imgUrl3="up_files/5.jpg"; imgtext3="$1k NL Hold'em - Double Digits Yo!"; imgLink3=escape("#"); imgUrl4="up_files/2.jpg"; imgtext4="$1k NL Hold'em - Double Digits Yo!"; imgLink4=escape("#"); imgUrl5="up_files/1.jpg"; imgtext5="$1k NL Hold'em - Double Digits Yo!"; imgLink5=escape("#"); var pics =imgUrl1+"|"+imgUrl2+"|"+imgUrl3+"|"+imgUrl4+"|"+imgUrl5; var links=imgLink1+"|"+imgLink2+"|"+imgLink3+"|"+imgLink4+"|"+imgLink5; var texts=imgtext1+"|"+imgtext2+"|"+imgtext3+"|"+imgtext4+"|"+imgtext5;
最后在 HTML 里调用:
<div class="ads">
<script type="text/javascript">
var swf_width=600;
var swf_height=250;
</script>
<script type="text/javascript" src="flash/cycle_image.js"></script>
</div>ok, 完成!
flashdata 下载
| anyShare分享到: | |
| |

Posted on 4,三 |
Posted by 姚 迎迎 











There are no comments yet
Log in to post a comment.