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

i don't know why my moving code not work

Explorer ,
Dec 17, 2018 Dec 17, 2018

import flash.events.KeyboardEvent;

stop();

function movecar (event:KeyboardEvent):void{

  if (event.keyCode == 37){

  car.x -=5;

  }

  }

  stage.addEventListener(KeyboardEvent.KEY_DOWN,movecar);

159
Translate
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
Community Expert ,
Dec 18, 2018 Dec 18, 2018
LATEST

Hi.

Your code is correct.

Are you sure that the instance you're trying to move is actually called "car"?

You can set the instance name by selecting the object on stage and going to the Properties panel.

Please see the image below to see the differences between instance properties and symbol properties.

animate_cc_as3_instance_name.png

Regards,

JC

Translate
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