专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > Flash

怎么使鼠标移动到动画上面,效果停止

发布时间:2011-06-27 20:01:36 文章来源:www.iduyao.cn 采编人员:星星草
如何使鼠标移动到动画上面,效果停止
HTML code

function init()
{
    playDirection = "left";
    imgSpeed = 30;
    rotateSpeed = 3000;
    imageWidth = 240;
    imageHeight = 410;
    this.createEmptyMovieClip("imgHolder", 1);
    imgHolder._x = 47;
    imgHolder._y = -1;
    targetAlpha = new Array();
    targetAlpha = [0, 100, 100, 100, 100, 0];
    targetX = new Array();
    targetX = [683, -57, 189, 437, 683, 683];
    targetY = new Array();
    targetY = [6, -15, -15, -15, -15, 6];
    getImageDepth = new Array();
    getImageDepth = [80, 90, 110, 200, 112, 100];
    targetS = new Array();
    targetS = [0, 100, 100, 100, 100, 0];
    targetVisible = new Array();
    targetVisible = [true, true, true, true, true, true, true];
    leftBtn.swapDepths(3000);
    rightBtn.swapDepths(3001);
    disable_btn.swapDepths(3002);
    textVisible = new Array();
    textVisible = [false, false, false, true, false, false, false];
    totalNum = imgNum;
    indexNum = 1;
    for (var _loc3 = 0; _loc3 < totalNum; ++_loc3)
    {
        imgHolder.attachMovie("img", "img" + _loc3, _loc3 + 10);
        var _loc2 = imgHolder["img" + _loc3];
        _loc2.no_txt.text = _loc3;
        _loc2._visible = false;
        _loc2._xscale = 50;
        _loc2._yscale = 50;
        _loc2._alpha = 0;
        _loc2.no_txt.text = _loc3;
        _loc2.no_txt._visible = false;
        loadThumbs(thumb_image[_loc3], _loc2.thumbs.th);
        loadThumbs(thumb_image[_loc3], _loc2.thumbs2.th);
        _loc2.desc_txt.autoSize = true;
        _loc2.desc_txt.text = img_name[_loc3];
        _loc2.desc_txt.text = img_name[_loc3];
        setBlurFilter(_loc2, 0, 0, 0);
        _loc2.textBg._width = _loc2.desc_txt.textWidth + 20;
        _loc2.desc_txt._visible = false;
        _loc2.textBg._visible = false;
        getLink(_loc2);
    } // end of for
    setBlurFilter(imgHolder.img2, 0, 0, 0);
    imgHolder.img2.desc_txt._visible = true;
    imgHolder.img2.textBg._visible = true;
    setMovie();
} // End of the function
function getLink(mc)
{
    mc.onRelease = function ()
    {
        getURL(img_link[Number(this._name.substr(3))], "");
    };
} // End of the function
function setMovie()
{
    for (var _loc2 = 0; _loc2 < totalNum; ++_loc2)
    {
        posNum = (indexNum + _loc2) % totalNum;
        var _loc1 = imgHolder["img" + _loc2];
        _loc1._visible = targetVisible[posNum];
        _loc1.desc_txt.autoSize = true;
        _loc1._x = targetX[posNum];
        _loc1._y = targetY[posNum];
        _loc1._xscale = targetS[posNum];
        _loc1._yscale = targetS[posNum];
        _loc1._alpha = targetAlpha[posNum];
        _loc1.swapDepths(getImageDepth[posNum]);
    } // end of for
} // End of the function
function rotateMovie()
{
    disable_btn._visible = true;
    for (var _loc2 = 0; _loc2 < totalNum; ++_loc2)
    {
        posNum = (indexNum + _loc2) % totalNum;
        var _loc1 = imgHolder["img" + _loc2];
        _loc1._visible = false;
        _loc1._visible = targetX[posNum];
        _loc1.desc_txt._visible = textVisible[posNum];
        _loc1.textBg._visible = textVisible[posNum];
        setBlurFilter(_loc1, 0, 0, 0);
        getLink(_loc1);
        if (_loc1.textBg._visible == true)
        {
            setBlurFilter(_loc1, 0, 0, 0);
        } // end if
        var _loc3 = new mx.transitions.Tween(_loc1, "_x", mx.transitions.easing.Strong.easeOut, _loc1._x, targetX[posNum], imgSpeed, false);
        new mx.transitions.Tween(_loc1, "_y", mx.transitions.easing.Strong.easeOut, _loc1._y, targetY[posNum], imgSpeed, false);
        new mx.transitions.Tween(_loc1, "_xscale", mx.transitions.easing.Strong.easeOut, _loc1._xscale, targetS[posNum], imgSpeed, false);
        new mx.transitions.Tween(_loc1, "_yscale", mx.transitions.easing.Strong.easeOut, _loc1._yscale, targetS[posNum], imgSpeed, false);
        new mx.transitions.Tween(_loc1, "_alpha", mx.transitions.easing.Strong.easeOut, _loc1._alpha, targetAlpha[posNum], imgSpeed, false);
        _loc1.swapDepths(getImageDepth[posNum]);
    } // end of for
} // End of the function
function setBlurFilter(mc, blurX, blurY, blurQuality)
{
    mc.cacheAsBitmap = true;
    var _loc2 = new flash.filters.BlurFilter(blurX, blurY, blurQuality);
    var _loc1 = new Array();
    _loc1.push(_loc2);
    mc.filters = _loc1;
} // End of the function
function loadThumbs(linkUrl, movLoader)
{
    var _loc3 = new MovieClipLoader();
    var _loc2 = new Object();
    _loc2.onLoadProgress = function (target, bytesLoaded, bytesTotal)
    {
        pctLoaded = Math.floor(bytesLoaded / bytesTotal * 100);
        target._parent.pBar_mc.gotoAndPlay(2);
        if (!isNaN(pctLoaded))
        {
            if (pctLoaded >= 100)
            {
                target._parent.pBar_mc.gotoAndPlay(2);
                this.gotoAndPlay(2);
            } // end if
        } // end if
    };
    _loc2.onLoadError = function (target_mc, errorCode, httpStatus)
    {
    };
    _loc2.onLoadInit = function (target)
    {
        new mx.transitions.Tween(target._parent.pBar_mc, "_alpha", mx.transitions.easing.Strong.easeOut, target._parent.pBar_mc._alpha, 0, 100, false);
        target._width = imageWidth;
        target._height = imageHeight;
    };
    _loc3.addListener(_loc2);
    _loc3.loadClip(linkUrl, movLoader);
} // End of the function
function autoRotate()
{
    leftBtn.gotoAndStop(1);
    rightBtn.gotoAndStop(1);
    if (playDirection == "right")
    {
        if (indexNum < totalNum)
        {
            ++indexNum;
            rotateMovie();
        } // end if
        if (indexNum == totalNum)
        {
            indexNum = 0;
        } // end if
    } // end if
    if (playDirection == "left")
    {
        if (indexNum > 0)
        {
            --indexNum;
            rotateMovie();
        } // end if
        if (indexNum == 0)
        {
            indexNum = totalNum;
        } // end if
    } // end if
} // End of the function
stop ();
init();
rightBtn.onRelease = function ()
{
    if (indexNum < totalNum)
    {
        ++indexNum;
        rotateMovie();
    } // end if
    if (indexNum == totalNum)
    {
        indexNum = 0;
    } // end if
};
leftBtn.onRelease = function ()
{
    if (indexNum > 0)
    {
        --indexNum;
        rotateMovie();
    } // end if
    if (indexNum == 0)
    {
        indexNum = totalNum;
    } // end if
};
leftBtn.onRollOver = function ()
{
    this.gotoAndStop(2);
    clearInterval(id);
};
rightBtn.onRollOver = function ()
{
    this.gotoAndStop(2);
    clearInterval(id);
};
rightBtn.onRollOut = function ()
{
    this.gotoAndStop(1);
    playDirection = this._name.substr(0, 5).toString();
    id = setInterval(autoRotate, rotateSpeed);
};
leftBtn.onRollOut = function ()
{
    this.gotoAndStop(1);
    playDirection = this._name.substr(0, 4).toString();
    id = setInterval(autoRotate, rotateSpeed);
};
id = setInterval(autoRotate, rotateSpeed);

友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: