如何保持帧之间的影片剪辑的颜色?影片剪辑、颜色

2023-09-08 13:07:50 作者:让眼泪倒流

我的应用程序有2帧;在第1帧有5个MC和一个 DOUBLE_CLICK 活动目标的颜色变化,并转到下一帧2 在框架2我有一个按钮,返回到第1帧。

如何才能保持MC的颜色,当我回到第1帧?

 公共类测试扩展影片剪辑
{
    公共功能测试()
    {
        VAR myMCTable:数组= [myMC1,myMC2,myMC3,myMC4,myMC5]。
        对于(VAR我:UINT = 0; I< myMCTable.length;我++)
        {
            myMCTable [I] .doubleClickEnabled = TRUE;
            myMCTable [I] .addEventListener(MouseEvent.DOUBLE_CLICK,changeColor);
        }
    }

    私有函数changeColor(E:MouseEvent)方法:无效
    {
        VAR newColorTransform:的ColorTransform =(e.target).transform.colorTransform;
        newColorTransform.color =的Math.random()* 0XFFFFFF;
        (e.target).transform.colorTransform = newColorTransform;
        nextFrame();
        goBack_btn.addEventListener(MouseEvent.CLICK,GoBack的);
    }

    私有函数GoBack的(E:MouseEvent)方法:无效
    {
        prevFrame();
    }
}
 

解决方案

如果你犯了一个类的影片剪辑(你有5个,我相信),他们都共享。创建一个名为myColor类属性,然后更新每个MovieClip对象的myColor属性时,它被双击的颜色变化,可以使GoBack的()方法,从自己的财产重新申请的每个影片剪辑的颜色。

这是否有道理?

Pr 入门教程 53 如何匹配场景中的剪辑颜色

My app has 2 frames; in frame 1 there are 5 MC and on a DOUBLE_CLICK event the target's color change and go to the next frame 2. In frame 2 I have a button to return to frame 1.

How can i maintain the MC color when I return to frame 1?

public class test extends MovieClip
{
    public function test()
    {
        var myMCTable:Array = [myMC1, myMC2, myMC3, myMC4, myMC5];
        for (var i:uint = 0; i < myMCTable.length; i++)
        {
            myMCTable[i].doubleClickEnabled = true;
            myMCTable[i].addEventListener(MouseEvent.DOUBLE_CLICK, changeColor);
        }
    }

    private function changeColor(e:MouseEvent) : void
    {
        var newColorTransform:ColorTransform = (e.target).transform.colorTransform;
        newColorTransform.color = Math.random() * 0xFFFFFF;
        (e.target).transform.colorTransform = newColorTransform;
        nextFrame();
        goBack_btn.addEventListener(MouseEvent.CLICK, goBack);
    }

    private function goBack(e:MouseEvent) : void
    {
        prevFrame();
    }
}

解决方案

If you make a class for the movieclips (you have 5 I believe) that they all share. Create a class property called myColor, then update each individual movieclip object's "myColor" property whenever it is double-clicked and the color changes, you can make the "goBack()" method re-apply each movieclip's color from its own property.

Does this make sense?