Hey Everyone as seen below I am trying to change the property of this Movie clip variable currentHex when it's called on using this line of code.
TweenMax.to(currentHex, 0.5, {scaleX:1.2, scaleY:1.2, ease:Back.easeInOut, repeat:1, yoyo:true, onComplete:resetGreyOut}); // tween animation
When the onCompleteis activated and it calls on the function resetGreyOut I get a 'Access of Undefined Property Error' I understand it's because it's a separate function and it can't find that var so I'm wondering how to go about finding or rather accessing that variable to change it in the 'resetGreyOut' function:
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();
}
}
}
Here is the resetGreyOut Function:
private function resetGreyOut():void
{
currentHex.gotoAndStop("GREY");
trace("GREEEEEY");
}
All help would be greatly appreciated. Thank you in advance!