创建flash 3D Carousel菜单

时间:2011-10-06 13:38:45

标签: flash menu carousel

嗨我有关于flash和动作脚本的小问题。

我的客户希望我在flash中创建3D轮播。它需要在椭圆路径上旋转(一种方式就足够了),鼠标悬停效果和鼠标重要的东西:图像需要按顺序加载...第一个图像旋转,然后第一个图像出现(在背景中)第一个在前面。 直到现在我使用来自oxylus开发的终极-3d轮播(as2)(http://www.oxylusflash.com/flashfiles/ultimate-3d-carousel-as2)但我完全不知道如何加载图像如上所述......

也许有人知道脚本/教程/提示如何做那种闪光旋转木马?我的AS技能非常有限......

或者也许有人知道如何修改现有脚本(我有来源) 我相信这是oxylus旋转木马女巫的一部分必须修改:

//loading picture to slideshow and configure it's parametters
function addPicture(nume,des,nm,par)
{
    nrp++;
    var mc=poze.attachMovie("holder","img"+nrp,poze.getNextHighestDepth());
    mc.canDraw=false;
    mc.des=des;
    mc.nm=nm;
    mc.par=par;
    mc._dx=0;
    mc._dy=0;
    mc.effSat=1;
    mc.effDark=1;
    mc.effAlpha=100;
    mc.effBlur=0;
    var mclListener:Object = new Object();
    var image_mcl:MovieClipLoader = new MovieClipLoader();
    image_mcl.addListener(mclListener);
    mc.holder_son.forceSmoothing=true;
    mc.cacheAsBitmap=true;
    image_mcl.loadClip(picturePath+nume,mc.holder_son);
    mc.anim._x=0;
    mc.anim._y=0;
    mclListener.onLoadInit = function(target_mc:MovieClip) 
    {
        mc.holder_son._alpha=0;
        var mc=target_mc;
        mc.forceSmoothing=true;
        mc.cacheAsBitmap=true;
        mc._rotation=-0;
        mc._width=fixWi;
        mc._height=fixHe;
        mc._x=-mc._width/2;
        mc._y=-mc._height/2;
        mc.ct=1;

        var mc2=mc._parent.attachMovie("holder","refl",mc._parent.getNextHighestDepth());
        mc2.anim.swapDepths(mc2.getNextHighestDepth());
        removeMovieClip(mc2.anim);
        var image_mcl:MovieClipLoader = new MovieClipLoader();
        image_mcl.loadClip(picturePath+nume,mc2.holder_son);
        image_mcl.addListener(mclListener);
        image_mcl.loadClip(picturePath+nume,mc.holder_son);
        mclListener.onLoadInit = function(target_mc:MovieClip) 
    {
        var mc=target_mc;
        mc.forceSmoothing=true;
        mc.cacheAsBitmap=true;
        var mcp=target_mc._parent;

        mc._width=fixWi;
        mc._height=fixHe;
        mc._rotation=-0;
        mc._x=-mc._width/2;
        mcp._alpha=100;
        var mc5=mcp.createEmptyMovieClip("desen",mcp.getNextHighestDepth());
        var mc3=mc._parent._parent.attachMovie("hMaska","hMaska",mc._parent._parent.getNextHighestDepth());


        mc3._width=fixWi+strokeSize;
        mc3._height=fixHe;
        mc3._rotation=-0;
        mc3._x=-mc._width/2-strokeSize/2;
        mc._parent._y=-fixHe/2;
        mc._yscale=-100;
        mc._y=fixHe*2;
        var mcX=mc._parent;
        mcX.cacheAsBitmap=true;
        mc3.cacheAsBitmap=true;
        mc._parent.swapDepths(mc2._parent.holder_son)
        mc.swapDepths(target_mc._parent.desen);
        mcX.setMask(mc3);
        mc3._y=fixHe/2;
        mc2._y=-fixHe+fixHe/4;
        mcX._alpha=0;
        mc._parent._parent.canDraw=true;
        if (nrp>1)poze._visible=true;
        var an=mc._parent._parent.anim;
        an._width=fixHe;
        an._height=fixHe;
        an.onEnterFrame=function()
        {
            this._alpha-=5;
            if (enRefl) 
            {
                mcX._alpha+=5;
                if (mcX._alpha>reflAlpha*2) mcX._alpha=reflAlpha*2;
            }
            else
            {
                mcX._alpha=100;
                mcX._visible=false;
            }
            mcX._parent.holder_son._alpha+=5;
            if (this._alpha<=0)
            {
                delete this.onEnterFrame
                removeMovieClip(this);
            }
        }

    }
    };
    mc.sc2=0;
    mc.gl=0;
    mc.attachMovie("mcToolTip","tt",mc.getNextHighestDepth());

    mc.onPress=function()
    {
        if(selCol!="")
        {
            if (this.par=="action")
            {
                pictureClick(this.nm);
            }
            else
            {
                getURL(this.nm,this.par);
            }
        }
    }

}


function refresh()
{
    slider._y=depY;
    mcArrows._y=depY;
    clicker._y=depY;

if (!enWheel) extraScale=0;

poze.mcLogo2.mcLogo._rotation=0;

this.poze._rotation=rotAngle;
offGuideY=fixHe;

poze.mcLogo2._alpha=logoAlpha;
poze.mcLogo2.mcLogo._width=logoWidth;
poze.mcLogo2.mcLogo._height=logoHeight;

poze.mcLogo2.mcLogo._x=-logoWidth/2;
poze.mcLogo2.mcLogo._y=-logoHeight/2;

poze.mcLogo2._rotation=-rotAngle;


poze.mcLogo2._visible=showLogo;


guide._x=poze._x-poze._width/2-offGuide/2;
guide._height=poze._height+offGuideY;
guide._width=poze._width+offGuide;
guide._y=-elev/2+spir*nrp/2;
var col=guide.hitTest(_xmouse+this._x,_ymouse+this._y,false)

var semnRot=1;
if (rotLeft==2) semnRot=-1;

if (!enSemnRot) semnRot=1;
else
{
    col=true;
}
if(!canRoll) col=false;

if (rotType==1)
{
    enSemnRot=false;
    mcArrows._visible=false;
    clicker._visible=false;
    slider._visible=false;
}

if (rotType==2) 
{
    enSemnRot=false;
    col=false;
    if (!goToStart)
    mcArrows._visible=true;
    clicker._visible=false;
    slider._visible=false;
    if (_root.selAr!=0)
    {
        spEase+=easeAm/100;
        if (spEase>=factSpeed/5) spEase=factSpeed/5;

        if (easeAm>=50)
        {
            spEase=factSpeed/5;
        }
    }
    else
    {
        spEase-=easeAm/100;
        if (spEase<=0) spEase=0;
        if (easeAm>=50)
        {
            spEase=0;
        }
    }
    cam.rot.y+=spEase*_root.selSemn;
}

if (rotType==3) 
{
    enSemnRot=false;
    col=false;
    mcArrows._visible=false;
    clicker._visible=false;
    slider._visible=true;
}

if (rotType==4) 
{
    enSemnRot=false;
    col=false;
    mcArrows._visible=false;
    clicker._visible=true;
    slider._visible=false;
    clicker.btnPrev._visible=showClickerArr;
    clicker.btnNext._visible=showClickerArr;
    if (clickerAutoPlay)
    {
        if (clickerCanAuto)
        {
            clickerAutoCrrTimer++;
            if (clickerAutoCrrTimer==clickerAutoMaxTimer)
            {
                disableClicker();
                clickerCanAuto=false;
                if (rotClickerLeft==1) clickerClick(++crrClick);
                if (rotClickerLeft==2) clickerClick(--crrClick);
                disableClicker();
            }
        }
        else
        {

        }
    }
}

if (rotType==5) 
{
    enSemnRot=true;
    mcArrows._visible=false;
    clicker._visible=false;
    slider._visible=false;
}

if (col)
{

    if (!doStop)
    {

        var catRot=poze._xmouse*factSpeed*semnRot*0.001;
        if (enSemnRot)  catRot=factSpeed*semnRot*100*0.001;
        speed=catRot;
        cam.rot.y+=speed;
    }
}
if (goToStart)
{
    cam.rot.y=goToVal;
    var val=goToVal;
    if (val<0)
    {
        val=360-Math.abs(goToVal);
    }
    slider.gotoPosition(val,true);
}

genCol=false;

selCol="";
for (var i=1;i<=nrp;i++)
{
    var mc=poze["img"+i];
    mc.holder_son._width=fixWi;
    mc.holder_son._height=fixHe;
    mc.holder_son._x=-mc.holder_son._width/2;
    mc.holder_son._y=-mc.holder_son._height/2;
    mc.refl.holder_son._width=fixWi;
    mc.refl.holder_son._height=fixHe;
    mc.refl.holder_son._y=-fixHe+fixHe/2-fixHe;
    mc.refl._yscale=-100;
    mc.refl.holder_son._x=-fixWi/2;
    mc.refl._y=reflDist;
    var col=mc.holder_son.hitTest(_xmouse+this._x,_ymouse+this._y,false)

    mc.isRoll=false;
    if(!canRoll) col=false;
    if (!genCol)
    {
    mc.useHandCursor=false;
    if (col && mc.enabled)
    {

        genCol=true
        mc.isRoll=true;
        selCol=mc;
        mc.useHandCursor=true;
        mcTooltip.mcttText.scris.autoSize=true;
        mcTooltip.mcttText._x=depTooltip/2;
        mcTooltip.mcttText.scris.text=mc.des;
        mcTooltip.bgr.bgr_son._width=mcTooltip.mcttText._width+depTooltip;
        mcTooltip.bgr.sageata._x=mcTooltip.bgr._width/2-mcTooltip.bgr.sageata._width/2;
    }
    }
    mc._parent.refl._visible=false;
    mc.tt._visible=false;
    mc.tt.mcttText.scris.autoSize=true;
    mc.tt.bgr._width=mc.tt.mcttText._width+depTooltip;
    mc.tt._x=-mc.tt._width/2;
    mc.tt.mcttText._x=depTooltip/2;
    if (enTt)
    {
        mc.tt._visible=ttlAways;
        mc.tt.gotoAndStop(mcTooltip._currentframe);
        mc.tt.bgr.sageata._visible=false;
        if (ttFolMouse) selCol.tt._visible=false;
        semnTT=-1;
        if (ttFollow==2) semnTT=1;
        mc.tt._y=semnTT*fixHe/2+semnTT*mc.tt._height-strokeSize/2;
        if (semnTT==1)  mc.tt._y=fixHe/2+strokeSize;
        if (!ttlAways && !ttFolMouse) selCol.tt._visible=true;
        mc.tt.mcttText.scris.text=mc.des;
    }
}
if (genCol || enTTFromClicker!=0)
{
    mcTooltip._x=_xmouse-mcTooltip.bgr._width/2;
    mcTooltip.bgr.sageata._visible=true;
    if (enTTFromClicker)
    {
        mcTooltip.mcttText.scris.autoSize=true;
        mcTooltip.mcttText._x=depTooltip/2;
        var ttText=poze["img"+enTTFromClicker].des
        mcTooltip.mcttText.scris.text=ttText;
        mcTooltip.bgr.bgr_son._width=mcTooltip.mcttText._width+depTooltip;
        mcTooltip.bgr.sageata._x=mcTooltip.bgr._width/2-mcTooltip.bgr.sageata._width/2;

    }

    var posY=selCol._y+selCol._height;
    if (ttFollow==1)
    {
        mcTooltip.bgr.sageata._yscale=100;
        mcTooltip._y=_ymouse-mcTooltip._height/2-depToolTipY;
        if (!ttFolMouse)
        {
            mcToolTip._visible=false;
        }

    }

    if (ttFollow==2)
    {
        mcTooltip.bgr.sageata._y=0.9;
        mcTooltip.bgr.sageata._yscale=-100;
        mcTooltip._y=_ymouse+mcTooltip._height/2+depToolTipY;
        if (!ttFolMouse)
        {
            mcTooltip._x=0;
            mcTooltip._y=39;
            mcTooltip.bgr.sageata._visible=false;
        }
    }
    mcTooltip._visible=true;
    mcTooltip._visible=enTt;
    if (!ttFolMouse)
    {
        mcTooltip._visible=false;
    }
    if (enTTFromClicker) mcTooltip._visible=true;

    mcTooltip._alpha+=10;
    if (mcTooltip._alpha>=100) mcTooltip._alpha=100;
    if (enStoponRoll) doStop=true;
}
else
{
    if (enStoponRoll) doStop=false;
    mcTooltip._alpha-=10;
    if (mcTooltip._alpha<=0) 
    {
        mcTooltip._alpha=0;
        mcTooltip._visible=false;
    }
}
render();
if (_root.xmlWindow._visible) loadWindow();

}

1 个答案:

答案 0 :(得分:0)