Newb actionscript question

OK so Im messing around with actionscript and ive made a ball i can move around the screen no problem

then i made a sprite movie clip of a man walking towards the top of the screen

I also have a sprite of a man walking to bottom of screen

and a profile sprite walking accross

each movie clip is name “Walking UP” , “Walking Accross”, “Walking Down”

now i want to make it so when i press up it shows the movie clip walking up
when i press left or right it shows the movie clip for walking across
and when i press down it shows the movie clip walking down

I can move it in all directions but i dont understand

can i make a virtual movieclip thats moving and the actuall clip inside is loaded dynamically? (if so how…im a big n00b at flash(Ive done some lua programming and fairly familliar with C++ )

or if not how can i make it behave like i want

Well if you wanted them to do the animations then you would need something like this:

If (Key.isDown(Key.UP))
{
Walking UP.gotoAndPlay(Walk);
Walking UP._y -= 5;
}

After re-reading it seems to me like you want the sprites to appear only when a button is pressed right?

if (Key.isDown(Key.UP))
{
Walking UP._visible = true;
}

You would then need to have some code that checks if there are any other sprites active and if so make _visible = false . Maybe you could just make all sprites invisible, or maybe have :

if (Key.isDown(Key.UP))
{
Walking UP._visible = true;
CurrentSprite = Walking Up;
}

Walking DOWN._visible = false;
Walking RIGHT._visible = false;
Walking LEFT._visible = false;
Walking UP._visible = false;
CurrentSprite._visible = true;

You set everything to false and then have CurrentSprite Visible, and it makes whatever sprite is active still on the screen because you told what the CurrentSprite is when you moved it.

EDIT: Another thing, what would be the easiest is if you have all the animations on different sprites make one sprite named Character and have 4 frames each one with a different sprite. Then label the frames like Left, Right, Up, Down, and so on. You would also want a frame that’s just the character standing still, this should be the very first frame, just put stop(); on that frame and on every other frame have gotoAndPlay(1);

That makes it so you have animations on different clips and you can put them all together and use the very easy Method A (the first part of code I posted on this reply). You could also try making it so you don’t need four standing still, each facing a different direction, I’m sure there’s a way to make the character dynamically turn to whatever direction you just went in.

cool thanks …
im a little confused about having each animation on a diff frame of the same animation

so I would create a new MC named character
in frame 1 I would put the MC of Walking UP
in frame 2 I would put the MC of Walking Accross
and in Frame 3 I would put the MC for walking down

So
Main CharacterMC{
Frame1 = Walking UP_MC(consists of about 7 frames)
Frame 2 = Walking accross_MC (again about 7 frames)
Frame 3 = Walking Down_MC (about 5 frames)
}

ahh ok i think i understand …just had to type it out and now it makes sense

[edit] BTW thanks alot for the quick and informative reply

No problem man, I’m here to help.