FORUMS: list search recent posts

How add on navigation key comand in Flash by ActionScrip code?

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Alejandro Castan
How add on navigation key comand in Flash by ActionScrip code?
on Feb 13, 2012 at 3:55:38 pm

Hi all
Since I am starting to develop in Flash by ActionScrip code, I would need your help. Would it be possible?
Well, I have one Flash project and it is very simple. I have a lot of fruits and I have a basquet to get them and then I got points for fruits collected or lost. Since I added the code to move the basquet with mouse event but I would need to modify it for that I can move the basquet by Navigation keys instead(left, right, down, up), for it, Could anybody help me with that?
Thanks and sorry for my little english.
Thanks in advance
Regards
Alejandro



Return to posts index

demetri tashie
Re: How add on navigation key comand in Flash by ActionScrip code?
on Feb 13, 2012 at 5:10:25 pm

alejandro,

this would be working with the KeyBoard Event and KEY_DOWN, where

right arrow keycode = 39
left arrow keycode = 37
up arrow =38 and
down arrow = 40

depending on your file set up, you might need to import these Classes:
import flash.ui.Keyboard;
import flash.events.KeyboardEvent;


you usually let the stage listen for the event ( they key being pressed). here is some basic code to get you started:
stage.addEventListener(KeyboardEvent.KEY_DOWN, listenForKeyDown);
function listenForKeyDown(e:KeyboardEvent):void {
if (e.keyCode == 38){
myMovieclipInstanceName.x+=15; // moves the mc 15 px
}
}


i hope that helps you


Return to posts index

Alejandro Castan
Re: How add on navigation key comand in Flash by ActionScrip code?
on Feb 13, 2012 at 6:06:02 pm

Hi Demetri,
I did what you told me and it works fine......
Thank you for your help !
Best Regards
Alejandro



Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]