flip symbol
hey
how can i flip symbol in animate?
i want to flip the player in game when you press the left key.
the result need to be player player walk right and when i press left he turned to left.
help please?
hey
how can i flip symbol in animate?
i want to flip the player in game when you press the left key.
the result need to be player player walk right and when i press left he turned to left.
help please?
how the syntax and the function will look if i in function of the parameter keycode?
root = this;
document.onkeydown = function(e) {
switch (e.keyCode) {
case 37: flipLeft();
break;
case 39: flipRight();
break;
}
};
function flipLeft(){
createjs.Tween.get(root.mcName).to(
{scaleX:-1},
250, createjs.Ease.elasticOut);
}
function flipRight(){
createjs.Tween.get(root.mcName).to(
{scaleX:1},
250, createjs.Ease.elasticOut);
}
Please note that mcName should be changed to match the instance name of the movie clip that you want to flip.
Also, just wanted to mention that Stack Overflow was super helpful in figuring this out: keyboard events - Detecting arrow key presses in JavaScript - Stack Overflow
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.