• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

flip symbol

New Here ,
Feb 21, 2017 Feb 21, 2017

Copy link to clipboard

Copied

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?

Views

2.6K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Advocate , Feb 21, 2017 Feb 21, 2017

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

...

Votes

Translate

Translate
Advocate ,
Feb 21, 2017 Feb 21, 2017

Copy link to clipboard

Copied

To flip a symbol:

Select your symbol.  Go to Modify > Transform > Flip Horizontal.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 21, 2017 Feb 21, 2017

Copy link to clipboard

Copied

but i want that it happen automaticlly

like in super mario

when you press right he walk right,when you press left the same mario walk left with the face to left.

//right arrow

  if (e.keyCode==39){

  kid.alpha=1;

  /*kid2.alpha=0;*/

  backR.x -=10;

  kid.x +=10;

  }

this is for right walk, i want that when i press left  the mario turn left so i need that the flip will be in the code

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 21, 2017 Feb 21, 2017

Copy link to clipboard

Copied

You just set the X scale negative instead of positive.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 21, 2017 Feb 21, 2017

Copy link to clipboard

Copied

how the syntax and the function will look if i in function of the parameter keycode?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Feb 21, 2017 Feb 21, 2017

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 23, 2017 Feb 23, 2017

Copy link to clipboard

Copied

LATEST

thank you!!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines