嘿,如下所示,每个人都在尝试使用此代码行调用此影片剪辑变量currentHex
时更改其属性。
TweenMax.to(currentHex, 0.5, {scaleX:1.2, scaleY:1.2, ease:Back.easeInOut, repeat:1, yoyo:true, onComplete:resetGreyOut}); // tween animation
激活onComplete
并调用函数resetGreyOut
时,我收到“访问未定义的属性错误”,我知道这是因为它是一个单独的函数,并且找不到该变量,所以我想知道如何在'resetGreyOut'函数中查找或访问该变量以对其进行更改:
private function resetHitTestHandler():void
{
for (var i:int = 0; i < aMainHexArray.length; i++)
{
var currentHex = aMainHexArray[i]; // All Hexs
if (resetHex.hit.hitTestObject(currentHex.hitBox) && bDragging)
{
if (currentHex.sColor == "BLUE")
{
currentHex.gotoAndStop("BLUE");
}else
if (currentHex.sColor == "RED")
{
currentHex.gotoAndStop("RED");
}else
if (currentHex.sColor == "YELLOW")
{
currentHex.gotoAndStop("YELLOW");
}else
if (currentHex.sColor == "PURPLE")
{
currentHex.gotoAndStop("PURPLE");
}else
if (currentHex.sColor == "GREEN")
{
currentHex.gotoAndStop("GREEN");
}else
if (currentHex.sColor == "WHITE")
{
currentHex.gotoAndStop("WHITE");
}else
if (currentHex.sColor == "ORANGE")
{
currentHex.gotoAndStop("ORANGE");
}
TweenMax.to(currentHex, 0.5, {scaleX:1.2, scaleY:1.2, ease:Back.easeInOut, repeat:1, yoyo:true, onComplete:resetGreyOut}); // tween animation
bDragging = false; // So doesnt loop
//Sound effect
if (bSoundIsOn)
{
// Play finish sound
matchSoundChannel = resetSound.play();
}
//Remove Sparks
nSparks -= nReset;
updateSparksCounter();
//Remove reset hex
resetHex.destroy();
}
}
}
这是resetGreyOut
函数:
private function resetGreyOut():void
{
currentHex.gotoAndStop("GREY");
trace("GREEEEEY");
}
所有帮助将不胜感激。预先谢谢你!