我有2帧,在第1帧中,目标MC颜色正在变为红色。之后我转到第2帧。如果我回到第1帧,MC不会保留RED颜色。我做错了什么。请看图片。 http://www.picz.ro/index.php?id=ec122060763b0fd744d2499882d4ae1f和http://www.picz.ro/index.php?id=00e207dfad35e7e414ed3236a1f79448
答案 0 :(得分:1)
消除帧,您可以使用以下代码执行此操作:
import flash.geom.ColorTransform;
import flash.events.MouseEvent;
var newColorTransform:ColorTransform;
var myMCTable:Array = [myMC1,myMC2,myMC3,myMC4,myMC5];
for (var i:int = 0; i < myMCTable.length; i++)
{
myMCTable[i].doubleClickEnabled = true;
myMCTable[i].addEventListener(MouseEvent.DOUBLE_CLICK, changeColor);
}
function changeColor(e:MouseEvent):void
{
newColorTransform = (e.target).transform.colorTransform;
newColorTransform.color = 0xFF0000;
(e.target).transform.colorTransform = newColorTransform;
}
prevNextBtn.txt.mouseEnabled = false;
prevNextBtn.addEventListener(MouseEvent.CLICK, prevNext);
function prevNext(e:MouseEvent):void
{
var i:int;
if (e.target.txt.text == "next")
{
e.target.txt.text = "prev";
for (i = 0; i < myMCTable.length; i++)
{
myMCTable[i].visible = false;
}
}
else
{
e.target.txt.text = "next";
for (i = 0; i < myMCTable.length; i++)
{
myMCTable[i].visible = true;
}
}
}
除了代码之外你需要改变的一切,现在你只有一个带有文本字段的按钮,名为“txt”,标签只是改变了