Can not get the player to do the walking, jumping, and standing anim

hi,
i cant seem you figure out how to get the player i have made to do the anim i have made for it.  i am kinda new to AS3 and could use any help i can get.  it kinda works but it never stops playing the last anim it did. for example if i walked to the right, it would just keep walking to the right even if i stop moveing, and if i jump it would play the jumping anim even after i land.  plz help if you can. thanks

this is the AS3 code i am using
import flash.events.KeyboardEvent;
import flash.events.Event;
var KeyThatIsPressed:uint;
var rightKeyIsDown:Boolean = false;
var leftKeyIsDown:Boolean = false;
var upKeyIsDown:Boolean = false;
var downKeyIsDown:Boolean = false;
var gravity:Number = 1;
var yVelocity:Number = 0;
var canJump:Boolean = false;
var canDoubleJump:Boolean = false;
stage.addEventListener(KeyboardEvent.KEY_DOWN,PressAKey);
stage.addEventListener(KeyboardEvent.KEY_UP,ReleaseAKey);
function PressAKey(event:KeyboardEvent):void
          if (event.keyCode == Keyboard.RIGHT)
                    rightKeyIsDown = true;
          if (event.keyCode == Keyboard.LEFT)
                    leftKeyIsDown = true;
          if (event.keyCode == Keyboard.UP)
                    upKeyIsDown = true;
          if (event.keyCode == Keyboard.DOWN)
                    downKeyIsDown = true;
function ReleaseAKey(event:KeyboardEvent):void
          if (event.keyCode == Keyboard.RIGHT)
                    rightKeyIsDown = false;
          if (event.keyCode == Keyboard.LEFT)
                    leftKeyIsDown = false;
          if (event.keyCode == Keyboard.UP)
                    upKeyIsDown = false;
          if (event.keyCode == Keyboard.DOWN)
                    downKeyIsDown = false;
sonic_mc.addEventListener(Event.ENTER_FRAME,moveTheSonic);
function moveTheSonic(event:Event):void
          if(rightKeyIsDown)
                    sonic_mc.x +=  7;
                    sonic_mc.scaleX=1;
                    sonic_mc.gotoAndStop(3);
          if(leftKeyIsDown)
                    sonic_mc.x -=  7;
                    sonic_mc.scaleX=1;
                    sonic_mc.gotoAndStop(4);
          if(upKeyIsDown&&canJump)
                    yVelocity = -15;
                    canJump = false;
                    canDoubleJump = true;
                    sonic_mc.gotoAndStop(5);
          if (upKeyIsDown&&canDoubleJump&&yVelocity>-2)
           yVelocity =-13;
           canDoubleJump=false;
          yVelocity +=  gravity;
          if(! floor_mc.hitTestPoint(sonic_mc.x,sonic_mc.y,true))
                    sonic_mc.y +=  yVelocity;
          if(yVelocity>20)
                    yVelocity = 20;
          for(var i:int=0; i<10; i++)
                    if (floor_mc.hitTestPoint(sonic_mc.x,sonic_mc.y,true))
                              sonic_mc.y--;
                              yVelocity = 0;
                              canJump = true;
what is not working how i want is line 64-93.  what i want to happen is i press a key and then it play the anim for the key that was pressed then when i stop holding the key down i want it to stop the anim and go back to the standing anim but thats not what it dose it lust keeps playing the same anim over and over again.
here is a vid of what happens
http://D:\Documents\BB FlashBack Movies\Untitled.html
if the vid dose not work sorry.

Similar Messages

  • Hi help unlock the phone happened after we installed a new programa we can not get the activation password and ID, I know and still does not stop the phone bought in Israel and what documents should be sent to confirm that my phone Please read through the

    hi help unlock the phone happened after we installed a new programa we can not get the activation password and ID, I know and still does not stop the phone bought in Israel and what documents should be sent to confirm that my phone Please read through the help

    What I am saying is ..........
    The iPhone HAS to be active making calls on the UK carrier network for the carrier to identify as "theirs" and therefore eligible for the Carrier to unlock
    The way to achieve this is to use a PAYG sim making and receiving calls to establish a customer relationship  with the Carrier and then follow the Carrier's process to unlock
    With a PAYG it usually means adding a specified (by the carrier ) amount  usually £15 /£20 depending on the carrier
    This is how O2 function and according to Gemma  this is how Vodafone work

  • I have Photoshop Elements 8 and upgraded to Windows 8.  I now can not get the CREATE menu, and other things.  How can I get them back?

    I have Photoshop Elements 8.  When I got a new computer running Windows 8 I no longer have access to the CREATE menu, among other things.  How can I load the program so that I have all of the stuff I had before.

    This is the Photoshop forum  Try asking in the Photoshop Elements forum:
    Photoshop Elements

  • I can not get the flash player plug in to work with Internet Explorer

    I can not get the flash player plug in to work with Internet Explorer

    Zoltan71 wrote:
    I just bought this computer. My Internet Explorer is version 11.0.1
    I have the box checked to Install new version automatically, but it has not done any upgrading.
    I can't get the computer to update anything as far as I can see.
    The flash plug in does work with the Crome browser but it will not work with Internet explorer.
    I looked in the manage add-ons and it says enabled.
    I also went into the safety tab and deselected
    Active X filtering.
    Restarted and still does not work.
    I need help.....
    Chrome uses a different and separate plug-in.
    There are things about IE you need to know, especially 11. Specifically:
    "User-Agent Strings"
    That doesn't mean a lot, I'm sure, but it's the root of your problems, and Flash Player has nothing to do with it.
    Microsoft "rewrote" the User-Agent Strings for the abomination they call their latest and greatest browser. User-Agent Strings are what websites use to identify the browser you're using and provide the proper content for it's browser engine, like ActiveX stuff, and Flash or HTML5 video. Thanks to the geniuses in Redmond, WA, the User-Agent Strings for IE11 (which has a Trident engine), ID it as either "Gecko" (Firefox) or "Webkit" (Chrome). Problem is: when the site the directs to the content for one of these two engines, the Trident engine in IE can't intepret it and the site then sees IE as an "unidentified" browser.
    The problem with an unidentified browser is that the plug-ins in that browser aren't recognized either, so even though you're up to date, it says you need the latest Flash Player when you use IE11. YouTube... has converted to HTML5 video so if it doesn't detect Flash Player, it can display HTML5 (MP4) video which requires no plug-in to play. Facebook can't do that, because HTML5 doesn't apply to games... only video.
    Microsoft has no plans to "fix" the mess they've created because they think it's a great idea to block you out of the websites you visit.
    They recommend using "Compatibility View" and pretending that you're using an older verison of IE... Problem with that is that it's seen limited success, and you have to enable it for EVERY page that has problems... individually.
    I'm not big on "pretending" so I recommend actually using another browser.
    Firefox (from Mozilla)
    Opera (from Opera)
    Safari (from Apple)
    Chrome (from Google)
    ANY of those will work where IE11 won't, with the Flash Player Plug-in (For all other browsers), and Chrome doesn't even need that because it has its own Flash Player plugin built in.

  • Can not get the Cisco TSP to show UP - 2003 64bit

    Can not get the Cisco TSP to show up on the list of Providers in Phone and Modem Options- Advance tab. Installed ver. 4.1, it seems to install correctly, with no errors but when I restart the server, there is no Cisco TSP001.tsp in the providers list. It works perfectly on my Windows 2003 servers, but will not work on this new Windows 2003 64 bit server. Any tricks to getting this to load?
    Thanks
    Keith

    Hi
    There is no 64-bit TSP yet. Whilst 32-bit apps will work OK for the most part on 64-bit via the WoW function, drivers tend to not be so flexible, and that's what TSP is...
    You'll have to bother your Cisco accounts folks to get this prioritised, it is upsetting a lot of people...
    Aaron
    Please rate helpful posts...

  • I have IMac 10.7.5 Lion I use I forgot the password and I did a few fixes from the we sites, which did not work and now I can not get the computer to reboot the gray screen comes on and if a shift c I get a load bar and it goes half way and help

    I have IMac 10.7.5 Lion I use I forgot the password and I did a few fixes from web sites, which did not work and now I can not get the computer to reboot the gray screen comes on with the apple and if a shift+c, I get a load bar and it goes half way and stops, I can get into the black screen area with the hard drive info
    I did the following:   mount -uw /    rm/var/db/.AppleSetupDone    shutdown/uses/us  reboot Ok I know I should not have, but now I need help to reboot and hopefully not lose everything on the desk top, Linda Markle

    You did the wrong things. In the future it's a good idea to remember not to do something when you don't know what you are doing and what happens when you do it.
    Forgot Your Account Password
    For Lion, Mountain Lion, or Mavericks
        Boot to the Recovery HD:
    Restart the computer and after the chime press and hold down the COMMAND and R keys until the menu screen appears. Alternatively, restart the computer and after the chime press and hold down the OPTION key until the boot manager screen appears. Select the Recovery HD and click on the downward pointing arrow button.
         When the menubar appears select Terminal from the Utilities menu.
         Enter resetpassword at the prompt and press RETURN. Follow
         instructions in the dialog window that will appear.
         Or see:
           Reset a Mac OS X 10.7 Lion Password
           OS X Mountain Lion- Reset a login password,
           OS X Mavericks- Solve password problems,
           OS X Lion- Apple ID can be used to reset your user account password.

  • TS3988 I just bought a Iphone 5 -- my Iphone 4 and my ipad used to automatically sinc calendars via the Icloud whenever I entered anything on either device -- I can not get the new phone to do this.I have  check the settings on both devices and they seem

    I just bought a Iphone 5 -- my Iphone 4 and my ipad used to automatically sinc calendars via the Icloud whenever I entered anything on either device -- I can not get the new phone to do this.I have  check the settings on both devices and they seem to be t

    There are only two things that you must do to connect a device to calendars:
    1)  In settings>icloud, you must log in, WITH THE CORRECT ID/PASSWORD, and
    2)  Turn on calendars on the same page.
    You said that the iphone 4 and ipad **used** to automatically sync.  Do they no long sync?

  • I just upgraded my iMac to OS 10.8.5 from 10.6.8 and now I can not get the calendars on my Mac and my iPhone 4s (running iOS 8.3) to sync

    I just upgraded my iMac to OS 10.8.5 from 10.6.8 and now I can not get the calendars on my Mac and my iPhone 4s (running iOS 8.3) to sync.  I already tried replacing the calendars on the phone with those on my computer but nothing happened.

    Set up iCloud
    Set up iCloud (2)

  • I have Adobe Photoshop Elements 10. It came installed on my HP Desktop. I am can not get the warp text tool to work. It has worked in the past. Once I click warp text, the little window does not pop up, and if I try to do anything else after I click warp

    I have Adobe Photoshop Elements 10. It came installed on my HP Desktop. I am can not get the warp text tool to work. It has worked in the past. Once I click warp text, the little window does not pop up, and if I try to do anything else after I click warp text, it wont let me. Just sounds the ding, alert, can still slightly navigate the program but can not use any other tools after clicking warp text. I just have to open task manager and close the program. not sure if I'm doing something wrong or maybe I just need to uninstall and re install. Having trouble finding out how to uninstall and reinstall because the program came pre installed on my desktop.

    It actually sounds like the warp text window is opening off screen.
    Resetting the photoshop elements 10 preferences should fix it.
    *Press and hold the Shift+Ctrl+Alt keys just after you start the launch of the photoshop elements 10 editor
    *Keep holding the keys down until you get a dialog asking if you want to delete the adobe photoshop elements setting file
    *Press Yes

  • Can not get the agent from rule determination

    Dear expert,
      We have a PR workflow,for one step, the agent is determined by one rule,In our Q system,everythink is ok to get the agent correctly,and the workflow also can works.but in our P system,can not get the agent from the rule,when we simulate the rule,the agent can be get smoothly,but in workflow,realy can't get the agent(after trace the workflow), so would you like to give me sone suggestion, whant had happen in our workflow?
    Many thanks!
    Best Regards,
    Kerry

    Tks!
    I have one question,how to check the agent assignment is active?
    and also want to say,the rule that determin the responsible agent is used at one step of the workflow,not for possible agent of task ,and the rule's type is RESPONSIBILITIES.
    Best Regards
    Edited by: Kerry Wang on Jun 25, 2010 3:14 AM

  • I have recently upgraded to mountain lion and I can not get the calendar application to work. I con appears on the side put on calendars. Any suggestions

    I have recently upgrades to Mountain Lion and I can not get the calendar utility to come alive. Icon appears in the tast bar but the application does not launch or appear to be any where else. Any suggestion?

    Did you look in the Applications folder for Calendar? If it is there, remove the item that is in the Dock and replace it by dragging the Calendar application to the Dock.
    If it is not there, did you have iCal located somewhere other than the Applications folder when you upgraded?

  • I can not get the latest version of itunes to update on my computer.  How can I do this?

    I can not get the newest version of itunes to update on my account.   How do I do this?

    What have you tried?
    What happened?
    Error message?
    What did it say?
    Any info?

  • HT5701 Downloaded Safari 6.0.4 and my software is not up to date to run it. I can not get the old version of Safari to work again.

    Downloaded Safari 6.0.4 and my software is not up to date to run it. I can not get the old version of Safari to work again.

    Open  > About this Mac, and tell us what OS X version you have. If it's 10.8, reinstall OS X 10.8.3 > http://support.apple.com/kb/DL1640
    If, after reinstalling the update, you still can't use Safari, hold Command and R keys while your computer is starting and reinstall Lion or Mountain Lion

  • HT1386 I have an app called ipieta which was originally downloaded onto an ipod. I gave the ipod to someone else, but now that I've had the iphone I can not get the audio even though it is downloaded into itunes music like it said to do.  It won't work.

    I have an app called ipieta which was originally downloaded onto an ipod. I gave the ipod to someone else, but now that I've had the iphone I can not get the audio even though it is downloaded into itunes music like it said to do.  It won't work.  I've tried more than several times to get help but nothing helps. Do I need to deauthorize the ipod or perhaps erase all the downloaded ipieta stuff and start over?
    Thanks for any suggestions

    Sorry. There's nothing anyone can do. The current version of the facebook app will not run on 4.2.1. The iPhone 3G won't run anything higher than 4.2.1. You're stuck.
    Maybe it's time to buy yourself a new iPod Touch.

  • My Macbook are from 2012, and i can not get the Airplay to work. Apple-tv3

    Hello,
    I can not get the Airplay  work betwine my Macbook  and Airplay.
    Have read a lot about it online, and can not understand way its-not work. My mac is from 2012. have dobbel Chek. Also with Serial number on our site.
    Do you have any answer for way its not work?

    Update to Mountain Lion, or higher, which is required.
    Troubleshooting AirPlay

Maybe you are looking for