【问题标题】:Flash hover caurina saturationFlash 悬停 caurina 饱和度
【发布时间】:2013-02-24 03:33:14
【问题描述】:

我有一个加载图像并在其上应用灰色饱和度的 Flash 项目。图像下方有一个按钮,当突出显示或鼠标悬停在该按钮上时,它会消除饱和度并恢复图像的原始颜色。这在演示模式和独立的 Flash 播放器中运行良好,但是当我尝试在线 (HTML) 页面使用它时,功能的悬停不再恢复图像的颜色。我的代码如下,我希望比我聪明的人知道问题所在。

谢谢。

    function parsXML()
{
    mainGalleryNode = gallery_xml.childNodes[0].childNodes;
    path = mainGalleryNode[_root.gallerySel - 1].attributes.path;
    lenGall = mainGalleryNode[_root.gallerySel - 1].childNodes.length;
    lenCat = mainGalleryNode.length;
    for (var _loc2 = 0; _loc2 < lenGall; ++_loc2)
    {
        arrayImage[_loc2] = path + mainGalleryNode[_root.gallerySel - 1].childNodes[_loc2].attributes.pic;
        arrayThumb[_loc2] = path + mainGalleryNode[_root.gallerySel - 1].childNodes[_loc2].attributes.thumbnail;
        arrayTitle[_loc2] = mainGalleryNode[_root.gallerySel - 1].childNodes[_loc2].attributes.name;
        arrayDescription[_loc2] = mainGalleryNode[_root.gallerySel - 1].childNodes[_loc2].attributes.description;
    } // end of for
} // End of the function


function arrayThumbs()
{
    for (var _loc3 = 1; _loc3 <= lenGall; ++_loc3)
    {
        _thumbs._thumbs.attachMovie("thumb", "thumb" + _loc3, _loc3);
        var _loc2 = _thumbs._thumbs["thumb" + _loc3];
        _loc2.index = _loc3;
        _loc2._y = Math.floor(_loc2._height + 1) * (_loc3 - 1);
        _loc2._mc._txt.text = _loc2.index;
        _loc2.onRollOver = function ()
        {
            this.gotoAndPlay("over");
        };
        _loc2.onRollOut = _loc2.onReleaseOutside = function ()
        {
            this.gotoAndPlay("out");
        };
        _loc2.onRelease = function ()
        {
            caurina.transitions.Tweener.addTween(_mc1._mc, {_saturation: 1, time: 5.000000E-001});
            mcLoader.loadClip(arrayImage[this.index - 1], _mc1._mc);
            currentIndex = this.index - 1;
            getDes();
        };
    } // end of for
    counter = 1;
} // End of the function


function menuCat()
{
    for (var _loc4 = 1; _loc4 <= lenCat; ++_loc4)
    {
        _category.attachMovie("btnCat", "btnCat" + _loc4, _loc4);
        var _loc3 = _category["btnCat" + _loc4];
        var _loc6 = _category["btnCat" + (_loc4 - 1)];
        _loc3.index = _loc4;
        arrayNameGall[_loc4 - 1] = mainGalleryNode[_loc4 - 1].attributes.name;
        _loc3._mc._txt.autoSize = true;
        _category["btnCat" + _loc4]._mc._txt.text = arrayNameGall[_loc4 - 1];
        _loc3._red._width = _loc3._mc._txt.textWidth + 10;
        _loc3._red._x = _loc3._mc._txt.textWidth / 2;
        _loc3._mask._width = _loc3._mc._txt.textWidth + 10;
        _loc3._mask._x = _loc3._mc._txt.textWidth / 2;
        for (var _loc5 = 1; _loc5 <= 3; ++_loc5)
        {
            _loc3["_arr" + _loc5]._x = _loc3._mc._txt.textWidth / 2 - 5;
        } // end of for
        _loc3._mask_red._txt.text = arrayNameGall[_loc4 - 1];
        _loc3._x = Math.floor(_loc6._x + _loc6._mc._txt.textWidth + intervalCat);
        if (_loc4 < lenCat)
        {
            _category._breakers.attachMovie("breaker", "breaker" + _loc4, _loc4);
            var _loc7 = _category._breakers["breaker" + _loc4];
            _loc7._x = _loc3._x + _loc3._mc._txt.textWidth + intervalBr;
        } // end if
        _category._x = 881 - _category._width;
        _loc3.onRollOver = function ()
        {
            if (this.index != _root.gallerySel)
            {
                btnCatOver(this._red, this._arr1);
            } // end if
        };
        _loc3.onRollOut = _loc3.onReleaseOutside = function ()
        {
            if (this.index != _root.gallerySel)
            {
                btnCatOut(this._red, this._arr1);
            } // end if
        };
        _loc3.onRelease = function ()
        {
            if (this.index != _root.gallerySel)
            {
                btnCatOut(_category["btnCat" + _root.gallerySel]._red, _category["btnCat" + _root.gallerySel]._arr1);
                clearThumbs();
                caurina.transitions.Tweener.addTween(_thumbs._thumbs, {_y: 0, time: 1, transition: "easeOutCubic"});
                yPos = 0;
                _root.gallerySel = this.index;
                parsXML();
                arrayThumbs();
                getDes();
                mcLoader.loadClip(arrayImage[0], _mc1._mc);
            } // end if
        };
    } // end of for
    btnCatOver(_category.btnCat1._red, _category.btnCat1._arr1);
} // End of the function

function btnCatOver(clip1, clip2)
{
    caurina.transitions.Tweener.addTween(clip1, {_y: 17, time: 3, transition: "easeOutCubic"});
    caurina.transitions.Tweener.addTween(clip2, {_y: -6, time: 5.000000E-001, transition: "easeOutCubic"});
    var _loc1 = new Sound();
    _loc1.attachSound("bt_snd");
    _loc1.start();
} // End of the function
function btnCatOut(clip1, clip2)
{
    caurina.transitions.Tweener.addTween(clip1, {_y: -27, time: 3, transition: "easeOutCubic"});
    caurina.transitions.Tweener.addTween(clip2, {_y: -24, time: 5.000000E-001, transition: "easeOutCubic"});
} // End of the function
function clearThumbs()
{
    for (var _loc1 = 1; _loc1 <= lenGall; ++_loc1)
    {
        _thumbs._thumbs["thumb" + _loc1].removeMovieClip();
    } // end of for
} // End of the function
function getDes()
{
    var _loc2 = new Object();
    _loc2.onMouseMove = function ()
    {
        if (_mask_des.hitTest(_root._xmouse, _root._ymouse))
        {
            caurina.transitions.Tweener.addTween(_descr, {_y: 407, time: 5.000000E-001, transition: "easeOutCubic"});
        }
        else
        {
            caurina.transitions.Tweener.addTween(_descr, {_y: 467, time: 5.000000E-001, transition: "easeOutCubic"});
        } // end else if
    };
    Mouse.addListener(_loc2);
    _descr._txt.text = arrayTitle[currentIndex];
} // End of the function
_thumbs._thumbs.setMask(_thumbs._mask);
_root.gallerySel = 1;
var lenGall;
var lenCat;
var mainGalleryNode;
var path;
var arrayImage = new Array();
var arrayThumb = new Array();
var arrayTitle = new Array();
var arrayDescription = new Array();
var arrayNameGall = new Array();
var currentIndex = 0;
var descStr;
var titleStr;
var sel = false;
var counter;
var intervalCat = 54;
var intervalBr = intervalCat / 2;
var yPos = 0;
var gallery_xml = new XML();
gallery_xml.ignoreWhite = true;
gallery_xml.onLoad = function (ok)
{
    if (ok)
    {
        parsXML();
        arrayThumbs();
        menuCat();
        getDes(); //Shows the Colour view bar
        _mc2._mc.unloadMovie();
        mcLoader.loadClip(arrayImage[0], _mc1._mc);

    } // end if
};
gallery_xml.load("cgal.xml");
btnTop.onRollOver = btnBottom.onRollOver = function ()
{
    this.gotoAndPlay("over");
};
btnTop.onRollOut = btnBottom.onRollOut = function ()
{
    this.gotoAndPlay("out");
};
btnBottom.onRelease = function ()
{
    if (_thumbs._thumbs._height > _thumbs._mask._height)
    {
        if (Math.abs(_thumbs._thumbs._y) < _thumbs._thumbs._height - _thumbs._mask._height && caurina.transitions.Tweener.isTweening(_thumbs._thumbs) != true)
        {
            yPos = yPos - (_thumbs._thumbs.thumb1._height + 1);
            caurina.transitions.Tweener.addTween(_thumbs._thumbs, {_y: yPos, time: 5.000000E-001, transition: "easeOutCubic"});
        } // end if
    } // end if
};
btnTop.onRelease = function ()
{
    if (_thumbs._thumbs._height > _thumbs._mask._height)
    {
        if (Math.abs(_thumbs._thumbs._y) > 0 && caurina.transitions.Tweener.isTweening(_thumbs._thumbs) != true)
        {
            yPos = yPos + (_thumbs._thumbs.thumb1._height + 1);
            caurina.transitions.Tweener.addTween(_thumbs._thumbs, {_y: yPos, time: 5.000000E-001, transition: "easeOutCubic"});
        } // end if
    } // end if
};
caurina.transitions.properties.ColorShortcuts.init();
_descr._btn_color.onRollOver = function ()
{
    caurina.transitions.Tweener.addTween(_mc2._mc, {_saturation: 1, time: 2});
};
_descr._btn_color.onRollOut = function ()
{
    caurina.transitions.Tweener.addTween(_mc2._mc, {_saturation: 0, time: 2});
};
var mcLoader = new MovieClipLoader();
var loadListener = new Object();
loadListener.onLoadStart = function (mcTarget)
{
    _root.loadImBig = true;
    _root._content.pages.page1.page1.attachMovie("mcPercents", "mcPercents", this.getNextHighestDepth());
    _root._content.pages.page1.page1.mcPercents._x = _mask_des._width / 2 - 10;
    _root._content.pages.page1.page1.mcPercents._y = _mask_des._height / 2 - 25;

};
loadListener.onLoadProgress = function (mcTarget, bytesLoaded, bytesTotal)
{
    var _loc2 = Math.ceil(bytesLoaded / bytesTotal * 100);
    _root._content.pages.page1.page1.mcPercents.txtPercents.text = _loc2 + "%";
};
loadListener.onLoadComplete = function (mcTarget)
{
    _root._content.pages.page1.page1.mcPercents.mcLoading.removeMovieClip();
    _root._content.pages.page1.page1.mcPercents.removeMovieClip();
};
loadListener.onLoadInit = function (mcTarget) //Controls the different tabs at the bottom
{
    caurina.transitions.Tweener.addTween(_mc2._mc, {_saturation: 0, time: 5.000000E-001});
    mask_mc.gotoAndPlay(2);
    _white.gotoAndPlay(2);
};
mcLoader.addListener(loadListener);

【问题讨论】:

    标签: html flash tween


    【解决方案1】:

    编辑:

    查看 snapplex 的项目文件后,问题似乎是当掩码完全为空时,Flash 版本之间的行为差​​异。

    灰色饱和度有一个蒙版,可以在空白帧上制作动画并完成。这隐藏测试环境中的蒙版对象(针对 Flash Player 8),但在浏览器中显示整个对象(使用最新的播放器版本)。

    一个快速的解决方法是向舞台外的蒙版添加一个形状,这会使蒙版对象在两个播放器版本中都不可见。

    (我原来的回答建议 Flash 没有收到没有焦点的翻转事件,但这是不正确的。)

    【讨论】:

    • 嗯,恐怕我唯一能想到的另一件事是网页上的 swf 上方是否有内容。如果你切换到使用点击,它是否有效?
    • 大卫,我可以通过电子邮件将 Flash 文档发送给您吗? (如果是这样,请给我发送电子邮件 snap@duckwar.com,我会将文件发送给您。)它在调试和独立运行时完​​美无缺,但当我尝试在具有该功能的浏览器中查看它时休息。在这一点上,如果我能找到导致灰色面具的原因,我会删除它并收工。任何帮助表示赞赏。
    • 我认为最初的去饱和是在loadListener.onLoadInit 代码的底部:caurina.transitions.Tweener.addTween(_mc2._mc, {_saturation: 0, time: 5.000000E-001});。我的电子邮件在我的个人资料中,但我不知道我是否能帮上忙,我有点没有想法。
    • 我尝试将其注释掉。我实际上将任何提及 _saturation: 0 更改为 1 但没有运气。我点击了你的个人资料,但我猜你的电子邮件被隐藏了?
    • 啊,奇怪。我一直在寻找一种偏好,但我没有看到。我给你发了一封电子邮件,但就像我说的那样,我不确定我还能想到什么。
    猜你喜欢
    • 1970-01-01
    • 2013-03-24
    • 2016-03-11
    • 2011-05-17
    • 2017-01-27
    • 2016-09-25
    • 2018-08-31
    • 2018-01-15
    • 1970-01-01
    相关资源
    最近更新 更多