Flash 视频广告的定位兼容性问题

所属分类: 媒体动画 / Flash教程 阅读数: 44
收藏 0 赞 0 分享
调用代码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns="http://www.w3.org/1999/xhtml ">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script language="javascript" type="text/javascript" src="flash.js"></script>
<style type="text/css">
body { height:1000px;width:100%}
.zhans_ship { width:250px; height:200px; Z-INDEX:99999; right: 0px; VISIBILITY: hidden; BORDER-BOTTOM: #000 2px solid; POSITION: absolute; BACKGROUND-COLOR: #000;top:378px;}
.top_ship { width:250px; height:26px; background-image:url(kkkk/msgTopBg.gif);font-family:"宋体"; font-size:12px; color:#FFFFFF;}
.top_ship div { width:150px; height:auto; float:left; line-height:20px;}
.bfq_a {font-size: 12px; background-image: url('kkkk/bomBg.gif');height:15px; line-height:15px; color: #ffffff;padding-top:2px; text-align:center;}
.bfq_a a:link { font-family:"宋体"; font-size:12px; text-decoration:none; color:#FFFFFF;}
.bfq_a a:visited { font-family:"宋体"; font-size:12px; text-decoration:none; color:#FFFFFF;}
.bfq_a a:active { font-family:"宋体"; font-size:12px; text-decoration:none; color:#FFFFFF;}
.bfq_a a:hover { font-family:"宋体"; font-size:12px; text-decoration:none; color:#FFFFFF;}
</style>
</head>
<body>
<div class="zhans_ship" id="eMeng">
<div class="top_ship"><div>视频广告:</div><span title=关闭 style="CURSOR: hand;color:white;font-size:12px;font-weight:bold;margin-right:4px; float:right; width:auto; height:auto; margin-top:3px;" onclick=closeDiv() >×</span></div>
<!-- flash 显示部分 start -->
<div class="mid_ship">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0 " width="250" height="150">
<param name="movie" value="player.swf">
<param name="quality" value="high">
<param name="allowFullScreen" value="true" />
<param name="FlashVars" value="vcastr_file=http://www.xxx.cn/zhaoshang.flv&vcastr_title=MiningGo&BarColor=0xFFffff&BarPosition=1&IsShowBar=3&BarTransparent=10&LogoText=Zgcjq.COM&IsAutoPlay=1&IsContinue=1" />
<embed src="player.swf" allowFullScreen="true" FlashVars="vcastr_file=http://www.xxx.com/images/zhaoshang.flv&vcastr_title=MiningGo&BarColor=0xFFffff&BarPosition=1&IsShowBar=3&BarTransparent=10&LogoText=Zgcjq.COM&IsAutoPlay=1&IsContinue=1" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer " wmode="transparent" type="application/x-shockwave-flash" width="250" height="150"></embed>
</object>
</div>
<!-- flash 显示部分 end -->
<div class="bfq_a"><a href="#" target="_blank">大型XX活动</a></div>
</div>
</body>
</html>
flash.js代码(修改后的)如下:
if(document.all){
window.attachEvent('onload',getMsg);
}else{
window.addEventListener('load',getMsg,false);
}
window.onresize = resizeDiv;
window.onerror = function(){}
var divTop,divLeft,divWidth,divHeight,docHeight,docWidth,objTimer,i = 0;
function getMsg()
{
try{
var eMeng = document.getElementById("eMeng");
/* 为修改前
var docWidth = document.documentElement.clientWidth;
var docHeight = document.documentElement.clientHeight;
*/
//修改后:
var docWidth = getWidth();
var docHeight = getHeight();
divTop = parseInt(eMeng.style.top,10);
divLeft = parseInt(eMeng.style.left,10);
divHeight = parseInt(eMeng.offsetHeight,10);
divWidth = parseInt(eMeng.offsetWidth,10);
eMeng.style.top = parseInt(document.documentElement.scrollTop,10) + docHeight + 10+"px" ;// divHeight
eMeng.style.left = parseInt(document.documentElement.scrollLeft,10) + docWidth - divWidth+"px" ;
eMeng.style.visibility = "visible";
objTimer = window.setInterval("moveDiv()",10)
}catch(e){
}
}
function resizeDiv()
{
i+=1;
try{
var eMeng = document.getElementById("eMeng");
var docWidth = getWidth();
var docHeight = getHeight();
divHeight = parseInt(eMeng.offsetHeight,10)
divWidth = parseInt(eMeng.offsetWidth,10)
eMeng.style.top = docHeight - divHeight + parseInt(document.documentElement.scrollTop,10)+"px" ;
eMeng.style.left = docWidth - divWidth + parseInt(document.documentElement.scrollLeft,10)+"px" ;
}catch(e){}
}
function moveDiv()
{
try
{
var eMeng = document.getElementById("eMeng");
var docWidth = getWidth();
var docHeight = getHeight();
divHeight = parseInt(eMeng.offsetHeight,10);
divWidth = parseInt(eMeng.offsetWidth,10);
if(parseInt(eMeng.style.top,10) <= (docHeight - divHeight + parseInt(document.documentElement.scrollTop,10)))
{
window.clearInterval(objTimer);
objTimer = window.setInterval("resizeDiv()",1);
}
divTop = parseInt(eMeng.style.top,10);
divTop--;
eMeng.style.top = divTop+"px" ;
}catch(e){
}
}
function closeDiv()
{
var eMeng = document.getElementById("eMeng");
eMeng.innerHTML='';
eMeng.style.visibility='hidden';
if(objTimer) window.clearInterval(objTimer);
}
/**
* 获取屏幕宽度的函数,在非xhtml标准页面下有可能有问题
*/
function getWidth()
{
var winWidth = '';
if (window.innerWidth)//for Firefox
{
winWidth = window.innerWidth;
}
else if((document.body) && (document.body.clientWidth))
{
winWidth = document.body.clientWidth;
}
if (document.documentElement && document.documentElement.clientWidth)
{
winWidth = document.documentElement.clientWidth;
}
return winWidth;
}
/**
* 获取屏幕高度的函数
* html,body高度属性必须设值为height:100%否则在火狐浏览器下获取不到真实高度
*/
function getHeight()
{
var winHeight = '';
if (window.innerHeight)//for Firefox
{
winHeight = window.innerHeight;
}
else if((document.body) && (document.body.clientHeight))
{
winHeight = document.body.clientHeight;
}
if (document.documentElement && document.documentElement.clientHeight)
{
winHeight = document.documentElement.clientHeight;
}
return winHeight;
}
*:红色部分为修改的位置或添加的代码
修改部分:
1.增强型的获取窗口长度和宽度的函数;
2.在style.top,style.left等处在Firefox下必须使用单位px;
3.调整 Flash参数之wmodel,即window model,详情请自己搜索;
修改以上几处,就可以实现IE,Firefox的准确定位和相同的显示效果。
更多精彩内容其他人还在看

Flash cs3绘制人物高级行走动画教程

本教程向大家介绍Flash cs3绘制人物高级行走动画效果,教程难度不是很大,绘制方法及过程介绍的也非常详细,教程很实用,转发过来,希望大家喜欢
收藏 0 赞 0 分享

Flash CS4来制作漂亮的气泡动画教程

本教程向脚本之家的朋友介绍用Flash CS4来制作漂亮的气泡动画,制作出来气泡真的很好看,制作效果是采用代码形式实现,觉得很不错,转发过来,感兴趣的朋友可以一起来学习
收藏 0 赞 0 分享

flash基础教程:帧、关键帧、空白帧概念及区别介绍

动画的产生是帧来实现的,那什么是帧?帧、关键帧和空白帧之间又有什么区别?本文就为大家介绍一下三者之间的关系
收藏 0 赞 0 分享

Flash教程:动画背景的绘制方法之透视篇(给新手)

Flash动画在网络上的广泛传播,已经成为上网一族喜闻乐见的一种艺术形式。动画背景的绘制方法有很多,也有很多表现方法。这里将结合透视学的基础知识向大家简单的介绍一下动画背景的绘制。
收藏 0 赞 0 分享

Flash AS入门教程:Flash AS3.0制作有年份有日期的时钟

本教程是向大家介绍利用Flash AS3.0制作有年份有日期的时钟,虽然制作时钟老套了点,但它确可以较全面地应用到时间日期和间隔等知识,仍不失为较好的入门练习,转发给大家,希望对大家有所帮助
收藏 0 赞 0 分享

Flash相册制作大师具体该如何使用 Flash相册制作大师使用教程

在本文中我们将会看到的是Flash相册制作大师的具体使用的方法
收藏 0 赞 0 分享

flash基础教程:混色器面板图文介绍

混色器面板是Flash中用于色彩处理的一个重要面板,熟练地使用该面板,可以帮助用户快速地完成色彩的填充,编辑出色彩丰富的图形。本教程为大家详细介绍一下混色器面板,希望对大家有所帮助
收藏 0 赞 0 分享

25个绝对让你应接不暇的Flash网站创意

在Web设计过程中,运用成熟的Flash技术可以把你任意想到的idea表现到产品页面中。这里为你整理发现了25个绝对让你应接不暇的 Flash网站创意,更好地体现网站的互动应用,同时可以让你大饱眼福,一起来欣赏吧
收藏 0 赞 0 分享

教你用Flash制作非常酷的二进制时钟动画

今天在这个教程中我们将学习用Flash做一个不同寻常的,但非常酷的时钟:一个二进制时钟,中间用到了代码,但介绍地很详细,相信很值得大家学习
收藏 0 赞 0 分享

Flash动画特效制作技巧:制作超酷的文字炸开动画效果

本教程向大家介绍Flash动画特效制作技巧,本实例是制作文字炸开的动画效果,制作效果非常酷,制作过程也比较简单,喜欢的朋友可以过来学习一下这种制作方法
收藏 0 赞 0 分享
查看更多