Changing a boolean inside a movieclip via the main stage.
I have a movieclip and within it is a bit of actionscript and a couple of different movieclips to make it function like the button on a ball point pen (you click it and it stays clicked until you click it again).
var booleanClick:Boolean = false;
var colorTransform:ColorTransform = optBox.transform.colorTransform;
optHitState.addEventListener(MouseEvent.CLICK, onClickHandler);
function onClickHandler(myEvent:MouseEvent){
if (booleanClick == false ) {
colorTransform.color = 0xB5CDE6;
optBox.transform.colorTransform = colorTransform;
booleanClick = true;
} else {
colorTransform.color = 0xFFFFFF;
optBox.transform.colorTransform = colorTransform;
booleanClick = false;
}
}
I have thirty-some-odd of these ball point pen movieclips on my main stage.
I want to be able to "clear" all the movieclips so that the optbox color is white and the booleanClick is false with a button that is on my main stage. Currently I've got it working for the optbox color, but when i try to trace out my boolean - it gives me nothing (not even an error).
var cClear:ColorTransform;
var optionArray = new Array ( mc1, mc2, mc3, mc4, mc5, mc6 ); // all my ball point pen movieclips are in this array.
clearButtons.addEventListener(MouseEvent.CLICK, goClear);
function goClear(e:MouseEvent):void {
for (var i:int = 0; i < optionArray.length; i++) {
cClear = optionArray.optBox.transform.colorTransform;
cClear.color = 0xFFFFFF;
optionArray.optBox.transform.colorTransform = cClear;
trace(optionArray.booleanClick + i);
optionArray.booleanClick = false;
trace(optionArray.booleanClick + i);
}
}
I don't want to get deeper into this monster of a project without making sure this is working first. Is my boolean working and just my trace statements aren't worded right or is my method to change the boolean wrong?