Actionscript onMouseOut 侦听器在 Internet Explorer 8 下不完全工作

发布于 2024-10-24 21:24:44 字数 1909 浏览 1 评论 0原文

我正在使用 Flash CS4 开发视频播放器。我正在尝试构建播放器,以便当用户将鼠标移到 Flash 对象上时,播放控件会出现,而当用户将鼠标移出 Flash 对象时,控件会消失。

我设法将一些代码放在一起,可以在除 Internet Explorer 之外的所有浏览器中运行。好吧,它“有效”,但前提是您将鼠标慢慢移到 Flash 对象的左侧。

我已经在谷歌上搜索了很多答案,但我似乎找不到有类似问题的人。

代码如下:

ActionScript 代码:


_root.onLoad = function(){
    _root.clip.skinAutoHide=true;
    _root.clip.skinFadeTime=0;
}

_root.onRollOver = function () {
    _root.clip.skinAutoHide=false;
}

_root.onRollOut = function () {
    _root.clip.skinAutoHide=true;
    _root.clip.skinFadeTime=0;
}

网站代码(插入 Flash 应该放置的位置):


var hasRightVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
if(hasRightVersion) {  // if we've detected an acceptable version
    // embed the flash movie
    AC_FL_RunContent(
        'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,24,0',
        'width', '280',
        'height', '280',
        'src', '01clip1',
        'quality', 'best',
        'pluginspage', 'http://www.adobe.com/go/getflashplayer',
        'align', 'middle',
        'play', 'true',
        'loop', 'true',
        'scale', 'noscale',
        'wmode', 'transparent',
        'devicefont', 'false',
        'id', '01clip1',
        'bgcolor', '#ffffff',
        'name', '01clip1',
        'menu', 'true',
        'allowFullScreen', 'false',
        'allowScriptAccess','sameDomain',
        'movie', '01clip1',
        'salign', ''
        ); //end AC code
} else {  // flash is too old or we can't detect the plugin
    var alternateContent = 'Alternate HTML content should be placed here.'
        + 'This content requires the Adobe Flash Player.'
        + 'Get Flash';
    document.write(alternateContent);  // insert non-flash content
}

任何见解将不胜感激。

I am working on a video player in Flash CS4. I'm trying to build the player such that when the user moves their mouse over the flash object, the playback controls appear and, when the user moves the mouse out of the flash object, the controls disappear.

I managed to get some code put together that works in every browser but one: Internet Explorer. Well, it 'works' but only if you slowly move the mouse out on the left side of the flash object.

I have done quite a bit of Google searching for an answer, but I can't seem to find someone with a similar problem.

Code is as follows:

ActionScript Code:


_root.onLoad = function(){
    _root.clip.skinAutoHide=true;
    _root.clip.skinFadeTime=0;
}

_root.onRollOver = function () {
    _root.clip.skinAutoHide=false;
}

_root.onRollOut = function () {
    _root.clip.skinAutoHide=true;
    _root.clip.skinFadeTime=0;
}

Website Code (Inserted where the flash should go):


var hasRightVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
if(hasRightVersion) {  // if we've detected an acceptable version
    // embed the flash movie
    AC_FL_RunContent(
        'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,24,0',
        'width', '280',
        'height', '280',
        'src', '01clip1',
        'quality', 'best',
        'pluginspage', 'http://www.adobe.com/go/getflashplayer',
        'align', 'middle',
        'play', 'true',
        'loop', 'true',
        'scale', 'noscale',
        'wmode', 'transparent',
        'devicefont', 'false',
        'id', '01clip1',
        'bgcolor', '#ffffff',
        'name', '01clip1',
        'menu', 'true',
        'allowFullScreen', 'false',
        'allowScriptAccess','sameDomain',
        'movie', '01clip1',
        'salign', ''
        ); //end AC code
} else {  // flash is too old or we can't detect the plugin
    var alternateContent = 'Alternate HTML content should be placed here.'
        + 'This content requires the Adobe Flash Player.'
        + 'Get Flash';
    document.write(alternateContent);  // insert non-flash content
}

Any insight would be appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

老旧海报 2024-10-31 21:24:44

好吧,我修好了。问题是显然 AS2 处理 mouseover/mouseout 的方法在这种情况下并不能很好地工作。我更新了闪存以使用 AS3 并使用了以下代码:


/*
Code lifted and slightly modified from:
http://board.flashkit.com/board/showthread.php?t=714795
*/
clip.skinAutoHide = false;
clip.skinBackgroundAlpha = 0;
clip.skin = "";

stage.addEventListener(Event.MOUSE_LEAVE, hideSkin);
stage.addEventListener(MouseEvent.MOUSE_MOVE, showSkin);

function showSkin(evt:Event=null):void {
    clip.skinBackgroundAlpha = 0.30;
    clip.skin = "SkinOverPlaySeekMute.swf";
}

function hideSkin(evt:Event=null):void {
    clip.skinBackgroundAlpha = 0;
    clip.skin = "";
}

我不完全确定为什么必须这样做,但这里的代码仍然适用于所有其他在那里用头撞桌子的人。

干杯。

Alright, I fixed it. The issue was that apparently the AS2 methods for working with mouseover/mouseout don't really work well in this instance. I update the flash to use AS3 and used the following code:


/*
Code lifted and slightly modified from:
http://board.flashkit.com/board/showthread.php?t=714795
*/
clip.skinAutoHide = false;
clip.skinBackgroundAlpha = 0;
clip.skin = "";

stage.addEventListener(Event.MOUSE_LEAVE, hideSkin);
stage.addEventListener(MouseEvent.MOUSE_MOVE, showSkin);

function showSkin(evt:Event=null):void {
    clip.skinBackgroundAlpha = 0.30;
    clip.skin = "SkinOverPlaySeekMute.swf";
}

function hideSkin(evt:Event=null):void {
    clip.skinBackgroundAlpha = 0;
    clip.skin = "";
}

I'm not entirely sure why it had to be done this way, but here's the code nonetheless for all you other people out there banging your head against your desk.

Cheers.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文