[英]Resizing Flash in IE8 is buggy
Problem 问题
When resizing a Flash object in IE, it's resize handler incorrectly thinks that only the stage width has been updated. 在IE中调整Flash对象的大小时,其调整大小处理程序错误地认为仅舞台宽度已更新。
Steps for reproducing the bug 重现该错误的步骤
Actionscript 动作脚本
package {
import flash.external.*;
public class Player {
public function Player(container:Stage) {
this.container.addEventListener(Event.RESIZE, this.onResize);
}
public function expand():void {
ExternalInterface.call('expand');
}
public function onResize():void {
// float chrome buttons to the right
// float chrome to the bottom
}
}
}
Javascript Java脚本
// Using Prototype framework
function expand() {
$('flash').setStyle({
width: '500px',
height: '400px'
});
// do other stuff in JS too
}
The listener gets triggered fine in all browsers except Internet Explorer. 在除Internet Explorer之外的所有浏览器中,都可以正常触发侦听器。 There's no problem with the Javascript - I see the Flash getting resized.
Javascript没问题-我看到Flash的大小有所调整。 But the Actionscript listener doesn't get fired until I my mouse moves out of the SWF.
但是,直到我将鼠标移出SWF时,动作脚本侦听器才会被触发。 What do I need to know about IE's rendering engine to fix this?
我需要了解有关IE渲染引擎的哪些信息才能解决此问题?
Before 之前
After - IE's Flash is notified of the width change, but still thinks it's height is the same. 之后 -IE的Flash收到宽度变化的通知,但仍然认为高度相同。
Move mouse out of SWF - you must roll your mouse out of the SWF for Flash to acknowledge its true height in IE8 将鼠标移出SWF-必须将鼠标移出SWF for Flash,才能确认其在IE8中的真实高度
not sure why that is, But I would suggest (or strongly recommend) that you add a callback on the flash side, and trigger it from javascript to force the call. 不知道为什么,但是我建议(或强烈建议)您在Flash端添加回调,并从javascript触发它以强制调用。
look into ExternalInterface.addCallback
看
ExternalInterface.addCallback
I could go on about how to get that part (js <-> Flash communicaiton) working, but someone's already done that. 我可以继续介绍如何使该部分(js <-> Flash通讯)正常工作,但是已经有人这样做了。
http://www.viget.com/inspire/bi-directional-actionscript-javascript-communication/ http://www.viget.com/inspire/bi-direction-actionscript-javascript-communication/
I solved this by setting Flash's height a 2nd time. 我通过第二次设置Flash的高度来解决此问题。 Even though it's set to the same height, it tricks IE to redraw the page.
即使将其设置为相同的高度,它也会欺骗IE重绘页面。
I had an issue similar to this. 我有一个与此类似的问题。 I used CSS to place the swf in a block, and use
overflow:hidden;
我使用CSS将swf放在一个块中,并使用
overflow:hidden;
to hide anything outside of my parameters. 隐藏我参数之外的任何内容。 Worked easy in ie8.
在ie8中工作简单。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.