Posted by Sankar.G | Posted in AS3 | Posted on 12:34 PM
you can able to get the ketboard event in action script 3.0
code:
parent.addEventListener(KeyboardEvent.KEY_DOWN.fun);
function fun(e:KeyboardEvent)
{
switch(e.keyCode)
{
case keyboard.RIGHT
movie_mc.x+=10;
break;
case keyboard.LEFT
movie_mc.x-=10;
break;
case keyboard.UP
movie_mc.y-=10;
break;
case keyboard.DOWN
movie_mc.y+=10;
break;
}
}
this is the way to get the keyboard Event using action script 3.0 movie_mc is a movie clip if you pressed the left button it will go to left side similarly to all side
code:
parent.addEventListener(KeyboardEvent.KEY_DOWN.fun);
function fun(e:KeyboardEvent)
{
switch(e.keyCode)
{
case keyboard.RIGHT
movie_mc.x+=10;
break;
case keyboard.LEFT
movie_mc.x-=10;
break;
case keyboard.UP
movie_mc.y-=10;
break;
case keyboard.DOWN
movie_mc.y+=10;
break;
}
}
this is the way to get the keyboard Event using action script 3.0 movie_mc is a movie clip if you pressed the left button it will go to left side similarly to all side
Comments (0)
Post a Comment