Actionscript 2 to 3. please help!

hey,

i have just started studying actionscript 3 at college and need some help migrating some script from 2 to 3. any help would be greatly appreciated:

ryu_mc.step=15;
ryu_mc.attack = false;
ryu_mc.stance= 1;
ryu_mc.crouch=false;

this.onEnterFrame = function()
{
if(ryu_mc.attack==false)
{
if (Key.isDown (Key.RIGHT) )
{
ryu_mc._xscale = 100;
ryu_mc.stance=1;
ryu_mc._x+=ryu_mc.step;
ryu_mc.gotoAndStop(“walking”);
}
else if (Key.isDown (Key.LEFT) )
{
ryu_mc._xscale = -100;
ryu_mc.stance=0;
ryu_mc._x-=ryu_mc.step;
ryu_mc.gotoAndStop(“walking”);
}
}
}

it is simply script in AS2 to make a character move left and right on the key getting pressed. any help migrating this to AS3 would be appreciated.

thanks

Here try this, it worked for me

ActionScript Code:
[LEFT][COLOR=#808080]*//initialize your variables, false by default*[/COLOR]

[COLOR=#000000]var[/COLOR] keyLeft:[COLOR=#0000FF]Boolean[/COLOR];
[COLOR=#000000]var[/COLOR] keyRight:[COLOR=#0000FF]Boolean[/COLOR];

[COLOR=#808080]//add keyboard event listeners to the stage that ‘listen’ for keyboard key presses[/COLOR]
[COLOR=#0000FF]stage[/COLOR].[COLOR=#000080]addEventListener[/COLOR]COLOR=#000000[/COLOR];
[COLOR=#0000FF]stage[/COLOR].[COLOR=#000080]addEventListener[/COLOR]COLOR=#000000[/COLOR];

[COLOR=#808080]//give you motion whenever keyLeft or keyRight is set to true;[/COLOR]
addEventListenerCOLOR=#000000[/COLOR];

[COLOR=#808080]//when key is pressed down[/COLOR]
[COLOR=#000000]function[/COLOR] keyDownFunctionCOLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#808080]//keyCode 37 is the left arrow key, 38 is up arrow, 39 is right arrow, 40 is down, and 32 is the spacebar[/COLOR]
[COLOR=#0000FF]if[/COLOR] [COLOR=#000000]([/COLOR]evt.[COLOR=#000080]keyCode[/COLOR] == [COLOR=#000080]37[/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
keyLeft = [COLOR=#000000]true[/COLOR];
[COLOR=#000000]}[/COLOR]
[COLOR=#0000FF]if[/COLOR] [COLOR=#000000]([/COLOR]evt.[COLOR=#000080]keyCode[/COLOR] == [COLOR=#000080]39[/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
keyRight = [COLOR=#000000]true[/COLOR];

[COLOR=#000000]}[/COLOR]

[COLOR=#000000]}[/COLOR]

[COLOR=#000000]function[/COLOR] keyUpFunctionCOLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#808080]//whenever a key is lifted, the variable is set to false, and the character stops moving[/COLOR]
[COLOR=#0000FF]if[/COLOR] [COLOR=#000000]([/COLOR]evt.[COLOR=#000080]keyCode[/COLOR] == [COLOR=#000080]37[/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
keyLeft = [COLOR=#000000]false[/COLOR];
[COLOR=#000000]}[/COLOR]
[COLOR=#0000FF]if[/COLOR] [COLOR=#000000]([/COLOR]evt.[COLOR=#000080]keyCode[/COLOR] == [COLOR=#000080]39[/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
keyRight = [COLOR=#000000]false[/COLOR];

[COLOR=#000000]}[/COLOR]

[COLOR=#000000]}[/COLOR]

[COLOR=#808080]//comes into play whenver keyLeft or keyRight is set to true[/COLOR]
[COLOR=#000000]function[/COLOR] moveObjectCOLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#0000FF]if[/COLOR] COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]

    ryu_mc.[COLOR=#000080]scaleX[/COLOR] = -[COLOR=#000080]100[/COLOR];
    ryu_mc.[COLOR=#000080]stance[/COLOR]=[COLOR=#000080]0[/COLOR];
    ryu_mc.[COLOR=#000080]x[/COLOR]-=ryu_mc.[COLOR=#000080]step[/COLOR];
    ryu_mc.[COLOR=#0000FF]gotoAndStop[/COLOR][COLOR=#000000]([/COLOR][COLOR=#FF0000]"walking"[/COLOR][COLOR=#000000])[/COLOR];

[COLOR=#000000]}[/COLOR] [COLOR=#0000FF]else[/COLOR] [COLOR=#0000FF]if[/COLOR] [COLOR=#000000]([/COLOR]keyRight[COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]

    ryu_mc.[COLOR=#000080]scaleX[/COLOR] = [COLOR=#000080]100[/COLOR];
    ryu_mc.[COLOR=#000080]stance[/COLOR]=[COLOR=#000080]1[/COLOR];
    ryu_mc.[COLOR=#000080]x[/COLOR]+=ryu_mc.[COLOR=#000080]step[/COLOR];
    ryu_mc.[COLOR=#0000FF]gotoAndStop[/COLOR][COLOR=#000000]([/COLOR][COLOR=#FF0000]"walking"[/COLOR][COLOR=#000000])[/COLOR];

[COLOR=#000000]}[/COLOR]

[COLOR=#000000]}[/COLOR]
[/LEFT]

If you want to use keyDown in as3 you should check out this class. http://www.senocular.com/flash/actionscript.php?file=ActionScript_3.0/com/senocular/utils/KeyObject.as

I want learn flash action action script from started.
can teach me ?
but i dont know english
please give me the tutorial with hindhi text

please give me the tutorial

My advice would be searching Google, for action script tutorials in your native language. Also maybe learning more English would help you, as there are lots of tutorials in English.

thank you to everyone for your responses. they are very much appreciated.