Sprite movement using arrow keys

Hello,
I have been working on a dragonball z game recently and I
have encountered a problem with the sprites.I have traced the
bitmap and everything else and even created a movieclip of the
sprite.I have put this code on the movieclip-
Code: ( text )
onClipEvent (load) {
step = 5;
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT) && this._x<550) {
this._x += step;
gotoAndPlay(2);
} else if (Key.isDown(Key.LEFT) && this._x>0) {
this._x -= step;
gotoAndPlay(10);
} else if (Key.isDown(Key.UP) && this._y>0) {
this._y -= step;
gotoAndPlay(15);
} else if (Key.isDown(Key.DOWN) && this._y<400) {
this._y += step;
gotoAndPlay(6);
I have put animations of the character walking on the
differnet frames inside the movieclip.For eg-
I have shown the character walking right from frame
2-5,walking down from frame 6-9,walking left from
frame10-14,walking up from frame 15-19.
THE PROBLEM is that whenever I press a specefic key(I will
take the example of right) and keep it pressed,IT DOES NOT PLAY THE
WHOlE ANI:MATION OF MOVING RIGHT.It just plays frame 2 and repeats
it instead of playing frames 2-5 together.
HELP is required!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Hi chinmayagoyal,
the problem is that your clip will be sent to frame 2, 10,
15, or 6 every time you press a key. So when you keep the key
pressed, it will keep sending the clip to that frame. You should
check if the animation is at a certain point.
Example: right movement: frame 2 to 6
if (Key.isDown(Key.RIGHT) && this._x<550) {
this._x += step;
if(this._currentframe==1 or this._currentframe>5){
gotoAndPlay(2);
Good luck,
Rick.

Similar Messages

  • After zooming in on an object using arrow keys to nudge, it crashes most of the time

    After zooming in on an object, using arrow keys to nudge, it crashes most of the time.
    Versions:
    Illustrator CS6, latest update
    Mac OS X 10.9.4
    FontAgent Pro 6.2
    Troubleshooting I've tried
    -trashed all related Illus. preferences
    -updated the only plug-in being used (FontAgent Pro), to the latest
    -disabled all but absolutely necessary fonts
    -repaired both system and user permissions
    -quit all other apps, so that only Illus. running.
    -fonts verified
    Was never a problem until a couple weeks ago, so the obvious question is "what changed?".  The two things we changed in the time period that the crashing started, is we replaced a balky external drive with a new one, and started our TimeMachine backups over again. And #2, we updated to the latest CS6 versions (due to other quirky issues).
    One odd thing to point out...perhaps is "normal", but in the crash reports, it's reporting that Illustrator is 16.0.0, but "About Illustrator" shows that it's 16.2.2.
    Everything else running fine on this iMac -- no reason to suspect it's the operating system.
    Has anyone run into this bug? If so, what have you done to fix this?
    I've not seen anything like this mentioned in Adobe's update change logs or their troubleshooting info.

    -> go to View Menu -> Toolbars -> select "Navigation Toolbar"
    -> go to View Menu -> Zoom -> click "Reset"
    -> go to View Menu -> Page Style -> select "Basic Page Style"
    -> go Tools Menu -> Clear Recent History -> Time range to clear: select EVERYTHING -> click Details (small arrow) button -> place Checkmarks on ALL Options -> click "Clear Now"
    -> go to Help Menu -> select "Restart with Add-ons Disabled"
    Firefox will close then it will open up with just basic Firefox. Now
    -> go to Tools Menu -> Add-ons -> Extensions section -> REMOVE any Unwanted/Suspicious Extension (add-ons) -> Restart Firefox
    You can enable the Trustworthy Add-ons later. Check and tell if its working.

  • Acrobat X Pro 10.1.12 under Yosemite crashes when trying to use arrow keys to navigate.

    Acrobat X Pro 10.1.12 Mac
    Yosemite OS X 10.10.1
    Acrobat now crashes when attempting to use arrow keys to navigate. This is true on both MacBook Pro 15 retina and Mac Pro.

    I ended up upgrading to Acrobat XI. This works, but Adobe is up to its old tricks changing the interface from what we're used to using. They now have decided to hide all the tools. You have to delve deep into the program to find the tools, then set up your own tool menus. Lord help you finding a tool that you use too occasionally to put on a custom menu.
    Adobe has been doing this for years now. In Photoshop of olden days, it was simple to set up a brush, say, that you used frequently. Quite a few updates ago they made that vastly more difficult. And they've replaced words with happy little icons, that are not at all intuitive to use. I challenge you, too, to look at the icon for the airbrush and tell me whether it is on or off. (Sorry, this is mainly about Photoshop, but what they've done to the latest Acrobat is just as bad.)
    Of course, their ultimate cuteness in making things difficult for the user is their essential abandonment of a Help system. You can't do a simple look-up of a function -- you have to go to an internet site and sort through a bunch of forums and user comments to get any information.
    JEEZ Adobe!

  • How do I browse through pictures (in open state) using arrow keys

    Hi all. I know this is a lame question. But I am new to Mac. How do we navigate through photos in open mode. I mean usually in Windows, we open one picture and use arrow keys to navigate between photos.What are the keys I can use to navigate between photos. As of now, I have to close the photo and then double tap on another to view it. Thanks.

    What application are you using? In iPhoto you can just use the right and left arrow keys to browse photos...
    Clinton

  • BI web use ARROW Keys

    Hello Everyone,
    I am in process of moving planning from Excel to IP with one of my client. Client wants to use ARROW keys to scroll left and right on layout beside using TAB.
    Can anyone help on this if you are aware how to add this functionality in BI Web ??
    Regards,
    Jasmi

    Daniel,
    I am assigning you points for your answer in other forum thread "Input functionality".
    We have one more requirement, when entering data, system should prompt "SAVE DATA" if user tries to navigate to other screen or close browser by mistake. Is it possible, if by any chance you are aware about it ??
    Also is it possible to copy same value across entire layout row / distribute equally by any button or function as we have layout for 24 months ??
    Regards,
    Jasmi

  • JComboBox problem when traversing using arrow keys and it is editable

    Hello,
    The JComboBox I am using is editable and user needs to traverse the list using arrow keys as long as user is not selecting a particular item. But this is not achievable when combobox is editable. Any suggestion to get rid of that.
    regards,
    Ranjan

    Huh?import java.awt.*;
    import javax.swing.*;
    public class Test3 extends JFrame {
      public Test3() {
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        Container content = getContentPane();
        JComboBox jcb = new JComboBox(new String[] {"One","Two","Three"});
        jcb.setEditable(true);
        content.add(jcb, BorderLayout.NORTH);
        setSize(100,100);
      public static void main(String[] args) { new Test3().setVisible(true); }
    }

  • Flash using arrow keys to move between frames in an animation

    Hi,
    Im currently creating a calculator on flash and I would like to be able to move to the next part of the calculator (the next frame) by using the arrow keys on my keyboard
    This is my current code to move between the frames using a buttons.
    stop();
    var input1:String;
    var input2:String;
    var Res:Number;
    var Quote:Number;
    txtLen.restrict = "0-9"
    txtWid.restrict = "0-9"
    BtnCon2.addEventListener(MouseEvent.CLICK,fnCall)
    function fnCall(Event:MouseEvent):void{
      input1 = txtLen.text;
      input2 = txtWid.text;
      Res = parseInt(input1) * parseInt(input2);
      Res.toString();
      gotoAndPlay(21)
      txtArea.text = String(Res);
    BtnRes1.addEventListener(MouseEvent.CLICK,fnRes1)
    function fnRes1(Event:MouseEvent):void{
      gotoAndPlay(1);
    Im trying to do the same thing that im doing with my buttons but with my arrow keys
    Thanks

    Another way to write what Ned said is instead of multiple if's, you could do something like:
    switch(yourEvent.keyCode) {
         case Keyboard.RIGHT:
              fnCall(null);
              break;
         case Keyboard.LEFT:
              fnRes1(null);
              break;
         case Keyboard.UP:
              //do up stuff
              break;
         case Keyboard.DOWN:
              //do down stuff
              break;
         default:
              trace('I\'m confused by this key.');
              break;
    Some people find this syntax more legible.

  • Cannot move inside the Fonts window using arrow keys?

    I'm pretty sure there was a way to move around in the Fonts menu using the arrow keys.  The selected Collection, Family or Typeface would turn from grey (not able to navigate) to the blue (able to navigate). 
    Does this ring a bell to anyone else?

    So I did search before posting this question but couldn't find anything.  Of course right after I post I found the answer.
    But this doesn't always work in all programs.
    You have to shift the focus to the font window by clicking on it, not just by clicking on a Collection, Family or Typeface line item.  Then the selected column will be highlighted blue, the Maximize, Minimize and Close buttons will be in color and the selected item will also be highlighted in blue.
    But this doesn't always work in all programs.
    Any ideas?

  • Can't use arrow keys to move cursor around TextArea after upgrading to 1.4

    Hi,
    I saw that there have been similar posts, but none are exactly the same nor have they solved my problem...
    I've got an older Java application that has been around for many years,
    the only updates to it essentially being upgrading the version of the
    JDK. So far, upgrading the JDK hasn't caused any issues. However, after upgrading to JDK 1.4, I can no longer use the arrow keys on the
    keyboard to move the cursor within a TextArea. You can use the mouse to highlight and you can use the rest of the keys (i.e. type in text,
    delete stuff, etc.) but somehow you just can't move the cursor around
    by using the keyboard. Does anybody have any suggestions on what I
    could do to solve this? Thanks in advance!

    Didn't get any replies/comments, but in case anybody is interested, I took the easy way out and upated the TextArea to a JTextArea and the problem went away.

  • Cannot use arrow keys to move an object in illustrator

    Can anyone tell me how to fix this?  Thanks!

    Is the object locked? If it's locked, then you can't even select it.
    If you can select it and it still won't move with arrows (I'm assuming it moves when you drag it), then perhaps the arrow "nudge" setting is so small it's not visible. Go to Edit > Preferences and look at "General" (the first page of settings. Make sure Keyboard Increment is set to something big enough to be useful.
    If all else fails, you might try exiting Illustrator and rebooting.

  • Bridge CC crashes while using arrow keys to switch images

    Adobe Photoshop CC 2014 Adobe Bridge 2014 on Mac is crashing every time I press an arrow key to move through images in bridge. I can click to manually select images with no problem, but using the up/down arrow keys to move to the next image up/down brings up the spinning beach ball and immediately locks the program up, requiring a force quit.
    Did the usual Mac permissions and fsck stuff to no avail. Ideas?
    Dan

    Thanks for moving my post to this correct forum. (I'm afraid I missed it when I originally posted.) A bit more information based on attempts to fix and on further attempts to use the program.
    After launching Bridge — before I select any specific image — it initially seems to work correctly. For example, I can use menu items and select and open folders. However...
    Once I drill down through folders to show raw files in the browser the problems begin. I can manually select an image by clicking on it, but the program the locks up if I do things such as attempt to navigate to another image using the up/down keyboard arrows or select anything from a menu that would perform an action on the image. (The problem happens with any image selected — not one particular image, and with images that worked fine until 48 hours ago.)
    ACR still works. I can double click an image and open the raw converter, and I can doubly click a smart object image in Photoshop do go back to the raw editor and it allows me to edit.
    I did the step of holding down command-option-shift at Bridge startup and selecting all three options to delete the cache and so forth. Still no joy.
    I did the usual Mac disk/file system repair stuff — repairing permissions and repairing disk — to no avail.
    I downloaded and reinstalled Bridge but the problem persists.
    Since I have a full backup of the drive on which Bridge is installed and since this backup drive is bootable, I double clicked the copy of Bridge on the backup drive... and it opened (slowly!) but worked correctly. (Not that this means much, but my second instance on my laptop continues to run fine.)
    I'm stuck, in a serious way, at this point. Thoughts?
    Thanks,
    Dan

  • ***Cant Scroll through fonts using arrow keys

    when trying to preview different fonts in AI i am unable to scroll through them using the arrow keys, it just doesnt move... can anyone tell me whats wrong? im sure its pretty simple but i have no idea how to fix it...if it can be fixed... oh im using cs3 and a mac on os x leopard

    you cant scroll through fonts in photoshop too. the scrolling stops on an item of the list (maybe photoshop has problem with it), and 1. in photoshop, you can't jump over it, you have to manually place the selection on the item after the one that blocked the scrolling, 2. illustrator will jump backward and you will keep scrolling about max 5-6 fonts over and over.
    the font groups divided with lines are meaningless. it doesn't have any relation with regional keysets or any good reason.
    a lot of unusable font f....d into the middle of the page.
    i have to scroll over a dozens of unusable system fonts, what I cannot uninstall from Windows.
    no font management at all.
    and yes waiting for another 300$ upgrade too.
    (plus another upgrade for a flash, because flash drawing tools didn't see upgrades in their whole lifetimes.
    these tools are covered with bugs from top to toe. because nobody takes care of them. 300$ / 1bug.)

  • Control Using Arrow Keys

    Hope someone can help. I am new to Flash CS4 - still learning - and this has had me stumped for days! Deadline is still the same though...
    I am redesigning a powerpoint presentation which contains a lot of graphs etc (29 slides total) and I want to animate this in Flash. I have everything drawn up in Illustrator and I'm now at the stage of bringing this all over to Flash.
    Once I have everything in Flash and animated, what I want to do is allow the presenter (my client) to control playback using the arrow keys (aka powerpoint). My intention is to have labels at the various stages of the graph where the animation will stop (using stop();) and then when the presenter presses the right arrow key the presentation will continue to play. I also need the left arrow key to go back to the previous label in case they advance too far or they have to go back to review something.
    I also wondered what best practice would be when creating something like this. Should I create separate Flash files for each 'slide' and load them (don't really know how to do this) or use separate movie clips for each slide within the one Flash file? My lack of knowledge leaves me wanting to build everything along the one timeline but I guess this would get too complicated...
    Apologies if this has been answered elsewhere but after searching both the Adobe site and the web I cannot find a suitable solution.
    Thanks in advance.

    I'll try...
    I have a presentation that I am working on which contains a series of graphs, charts etc that I have animated. This is navigated through by using your earlier code for the arrow keys.
    Originally I had everything sitting on one timeline but this was getting too complicated to make the changes that I needed to do so I have spit each section into a separate file - now have 26 files plus the loader.
    I now need to be able to move backwards from one loaded movie to the previous one - ie a section loads - the presenter moves through it using the arrow keys, but if they have to go back they can simply keep pressing the arrow key to get to the start of that section and then when they press it again it will load up the previous .swf file (hope this is making sense).
    Code I have in my loader file:
    var ldr:Loader=new Loader ();
    addChild(ldr);
    loadNext("sections/01title.swf");
    function loadNext(swfName:String) {
    ldr.unloadAndStop();
    ldr.load(new URLRequest(swfName));
    Code I have in each section at the start to use the arrow keys:
    stop();
    // create an array to hold the names of the frame labels
    var labels:Array = new Array();
    // take the name of each label in a MovieClip and put each
    // one into the array...
    for (var l:* in this.currentLabels) {
        labels.push(this.currentLabels[l].name);
    // add an event listener to the stage to listen for key strokes
    stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
    // the function that interprets key strokes
    function keyDownHandler(event:KeyboardEvent):void {
        // find out where you are in the movieClip...
        var thisOne:* =labels.indexOf(currentLabel);
        // use the left or right arrow key press...
        switch (event.keyCode) {
            case 37 :// left arrow key
                if (thisOne!=0) {
                    gotoAndPlay(labels[thisOne -1]);
                break;
            case 39 :// right arrow key
                if (thisOne!=labels.length-1) {
                    gotoAndPlay(labels[thisOne + 1]);
                break;
    And at the end of each section I have the following code to load up the next movie:
    MovieClip(this.parent.parent).loadNext("sections/08woodmanagement.swf");
    I see that you have replied to my new post about this - do you want me to reply to that and stop using this thread?

  • Moving an object using arrow keys

    I think I changed  the default distance to move an object using the arrow keys from 1 Point (1/72 of an inch). Can someone help me with changing it back to the default or tell me how to adjust the distance you can move an object like a text field using the arrow keys. Thank you.

    It's based on your grid Interval setting on the Drawing Aids palette. For a 1 point grid you would need an Interval of 12/pc (although it says points the grid measurement is picas, 12 points to the pica).
    I find 1 point too fine, I use a grid of 4/pc (3 points) and have all my object measurements base around multiples of 3.

  • CTI Doesn't Move with Arrow Keys PE12

    I am running into a glitch in Premiere Elements 12. When I nudge the CTI (playhead) using the arrow keys it moves only 1 frame no matter how many times I press the over arrow. The audio continues to scrub and the time indicator continues to change for each frame, but the CTI itself is stuck and no longer represents the proper location.
    Anyone solved this?
    I am using a MacBook Pro running OS 10.8.5.

    Thanks ATR for you reply, here I will try to explain my findings.
    My hw. sw. setup
    MACBook Pro, OS X 10.9.4, 16Gb, licensed Premiere Elements 12.1 upgraded from 12.0
    Just to confirm....are you saying that if you do just a one tap on the right or left arrow key, the Timeline Indicator will move 1 frame.              YES (if slow repeat).
    But, if you hold down and continue to hold down on the right of the right or left arrow key, the Timeline Indicator will not go into a continuing movement?     YES.
    >> Today I have found that this problem only show up in ”Expert” edit mode and not in ”Quick” mode.
          1. Current Timeline Indicator (CTI) only move/jump one frame when I first start to hold right or left key pressed, after this first jump CTI will stop to move,
                my movie and time counter will move and count as expected.
          2. If I repeat pressing right or left key with a speed faster than one press per 3seconds the CTI will be stopped,  slower repeat than every 3 second then CTI will move on every key press.  
          3. Note1   when CTI not move during continue key press or fast repeat R/L (< 3sec) the accumulated new CLI position will show up as a long jump on next press after 3sec paus.  
          4. Note2   I have also verifies with my Win7 friend with a new installed PE 12.1 running just fine without this CTI problem.  (MAC version only??)
    If so, several things that I would like you to do if you have not already....
    1. Delete the Adobe Premiere Elements Prefs file which should be found
        Users\Libraries\Application Support\Adobe\Premiere Elements\12
    >> After I delete the Adobe Premiere Elements Prefs file I did restart PE12 program and created  a new project ( an new PE Prefs was automatic create in the same directory as expected)
          But unfortunately my problem is still there.  
    2. In the opened project, go to Edit Menu/Preferences/General and experiment with the Timeline Playback Auto-Scrolling Options (No Scroll, Page Scroll, and Smooth Scroll).
    ATR Premiere Elements Troubleshooting: PE12/12.1: Timeline Playback Auto-Scrolling
    >> Thanks, here I found lot of good reading but your suggestion to change the Timeline Playback Auto-Scrolling Options did change scrolling behavior,
           unfortunately my problem is still there. 
    I am strictly an Elements Windows user, so please double check the translation of the suggested locations from Windows to Mac.
    How would describe your issue - "it worked before but not now" or "it never worked before".
    >> My best answer must be;  I have not seen this problem before but I´m trying to learn video editing so I could have missed the CTI behavior.
    Looking forward to your follow up.
    Thank you.
    Add On...Like the originator of this thread, are you working with a tryout of Premiere Elements 12/12.1?
    No this is a licensed version 12.0 upgraded to 12.1
    Summary:
    My conclusion must be that this CTI behavior is a software bug  (maybe only in MAC versionPE12 or in  some combination).
    How to fix my problem:
    Will a reinstall likely fix the problem?
    Or is´t a case for Adobe Support to handle? 
    I´m happy for any help here.
    Regards.
    Per

Maybe you are looking for

  • Is there a limit to the number of apps you can put in a folder in Launchpad?

    I have one folder with 24 apps in it and I cannot seem to add another app to it.

  • Reg: Mass generation of roles with open authorization

    Hi,          Is there an option to mass generate roles with open authorizations ?          It would be helpful if it there exists some transactions or reports that would help in doing so unlike CATT scripts or batch sessions. Regards,

  • ITunes shuts down  how to repair? Error (-42032)

    Error (-42032) I have downloaded the last version. Tried several times to make it work,  repair etc. But when I rip audio-books I cannot write in "info", it only shuts down then. I can write info in a doc and then copy/paste, but this is veryinconven

  • Tax code should be valid for A/P error

    Hello, I have created a new company and setup all the master data and G/L determination information. The account payable is also set for the vendor. On the line item the tax code has the A/P account set. When I try to add a new purchase order I get a

  • EAR 1.5 not available in NWDS 7.2?

    Hi guys, I installed the IDE for composition environment 7.2 with all possible versions of the JAVA SDK's. When I try to create an EAR project, though, I only get options for version 5.0 and 1.4 For a webservice however, I need 1.5 Any of you ever en