samedi 4 mars 2017

How to recolor a movieclip with second click?

Lets say i have a movieclip on stage. Every time this movieclip is clicked i want it to change color but if is click again i want it to recolor (becomes white again). To be more clear It is white and with the first click i want it to become yellow, with the second click to become white again and with the third click to become yellow again and so on. I just wrote the the code for the first click but I can't think how to do the rest.

var myColorTransform:ColorTransform=transform.colorTransform;

half1a.addEventListener(MouseEvent.CLICK, changeColour);

function changeColour(event:MouseEvent):void
{
       myColorTransform.color = 0xD5E40D;
       half1a.transform.colorTransform=myColorTransform;
       addChild(half_number1a);
}

Aucun commentaire:

Enregistrer un commentaire