class to control the entrance to the keyboard for a mc: could not convert to AS2

Hi - I have an AS2 code to meet to keyboard entries - it was great because it added friction, thrust, gravity, etc... That is to say: he did very real and added movements gameplay which is key in engaging players. He past in classes for OBJECT oriented programming I do not seem to have reason. Could I ask for help, or maybe someone knows a nice tutorial for the same thing.

It was Emanuel Feronato tut in AS2

http://www.emanueleferonato.com/2006/10/29/Flash-game-creation-tutorial-part-1/

RocketMainDocClass

package {}

import flash.display.MovieClip;
import flash.events. *;
import flash.ui.Keyboard;

SerializableAttribute public class RocketMainDocClass extends MovieClip {}

var rocket: rocket = new rocket;

public void RocketMainDocClass() {}
stage.addEventListener (KeyboardEvent.KEY_DOWN, keyDownHandler);
addEventListener (Event.ENTER_FRAME, onEnterFrameHandler);
addChild (rocket);
}
private void onEnterFrameHandler(e:Event):void
{
rocket.movePerFrame ();
}
private void keyDownHandler(e:KeyboardEvent):void
{
switch (e.keyCode)
{
case 37: //left
rocket.moveLeft ();
break;
38-case: //up
rocket.moveUp ();
break;
Box 39: //right
rocket.moveRight ();
break;
}
}

}

}

Rocket.As

package
{
any necessary import I think
import flash.display.MovieClip;

Rocket/public class extends MovieClip
{
public var power: Number = 0.3;
public var yspeed:Number = 0;
public var xspeed:Number = 0;
public var friction: Number = 0.95;
public var gravity: Number = 0.1;
public var thrust: Number = 0.75;
public var wind: Number = 0.09;

public void Rocket()
{
stage.addEventListener (KeyboardEvent.KEY_DOWN, keyDownHandler);
}
public void movePerFrame()
{
This.XSpeed * = friction;
This.yspeed += gravity;
This.y += yspeed;
This.x += xspeed;
}
public function moveLeft (): void
{
XSpeed = power;
XSpeed * = friction;
yspeed += gravity;
y += yspeed;
x xspeed +=;

}
public function moveRight (): void
{
This.XSpeed += power;
XSpeed * = friction;
yspeed += gravity;
y += yspeed;
x xspeed +=;
}
public function moveUp (): void
{
This.yspeed = power * overlap;
XSpeed * = friction;
yspeed += gravity;
y += yspeed;
x xspeed +=;
}

}
}

Make sure that you touch shortcuts are disabled if you use the flash test environment.  If this isn't the problem, use the backtrace function.

Tags: Adobe Animate

Similar Questions

  • Some keys on the keyboard for Satellite A200 do not react

    Hello to you all.

    Recently, I had serious problems with a few keys. They do not react when I press on them. Oddly, enough it happened one day where everything worked perfectly. Currently a non-flexible solution (: @) is a mix of keyboard and Vista on-screen keyboard. I have spilled something on my laptop that I take great care of it. Keys not working do not are:

    K k
    U u
    I have I
    M m
    J j

    7
    8

    ,
    *

    Up arrow
    Arrow pointing down

    I also remember the day, this problem occurred (and since then, every day when the laptop boots) in startup screen logo is continuous-interminnent beeps. Alsowhen Office appears and then press 'Start' (Windows logo) I see constantly writing in the prompt search (under "all programs") and that if I press the right arrow it wll not stop. Any ideas? I guess from a driver issue... I hope someone help...

    P.S.:strangely (with the exception of added value package) I can't update my Toshiba laptop (they all fail with an error). First, I do the update of the BIOS?

    Hi Herc,

    The description of your problem doesn't quite sound as if your keyboard has developed a fault, particularly in failing the grouping of keys held. If you have access to a USB port on the keyboard I sugest you try and see if you get the same problem.

    If your A200 is still covered by warranty, then I suggest that return you it to a repairer approved for repair. If your warranty has expired so fortunately replacement keyboards are not only expemsuve and are fairly easy to replace, just try to Google for a suitable provider.

    I don't think that your problem is related to software or drivers

    Kind regards

  • Backlight on the keyboard for Dell laptop does not work.

    I have a Dell Inspiron 17R SE and the backlight on the keyboard stopped lighting upward. Keyboard shortcutis "FN + F6" but that doesn't work either. I need to know how turn them back on.

    On many laptops Dell I've owned, the shortcuts to activate backlight switch is Fn + CursorRight.
    You can try this key combination?

    In addition, the backlight of the keyboard can be disabled in the BIOS. This is the menu that you get when you press F2 for when your laptop is cold-start and displays the Dell Logo and a progress bar under. If it is disabled, there is no way you can use a shortcut to turn on, you will need to enable it in the BIOS OF THE first.

  • the installer for Adobe CS6 could not initialize on el capitan

    I tried to download the trial version to start the program installation and my copy of disk, but Installer is not both, I have just upgraded to a new macbook pro running el capitan, I can run the installation program on the earlier on my old computer operating system so I guess that it is a problem of software for adobe/apple support solve? is this likely with cs6 being old enough now?

    I ended up resloving cela by installing Java (via a link on the site of apple - think it was Java 6) and then restarting. I had read other than El capitan mess Java settings... Seems to be ok, now, at least!

  • Volume F4 - F5 key on the keyboard for mac does not work on the microsoft side

    Volume F4 - F5 on the keyboard for mac key does not work... on the side of microsoft may not decrease or increase volume

    Hello

    ·         What do you mean by Microsoft Side?

    ·         Have you tried to update the latest audio drivers for the computer?

    ·         Were there any changes made on the computer before the show?

    Also I suggest you to contact the Apple support:

    http://www.Apple.com/support/Mac/

    See also: http://windows.microsoft.com/en-US/windows/help/no-sound-in-windows

  • How to connect the keyboard for apple tv wireless?

    How to connect the keyboard for apple tv wireless?

    If you mean the 4th generation new Apple Tv, you cannot currently. It does not support keyboards at this time.

    If you mean the 3rd generation Apple Tv:

    Use a keyboard Apple Wireless with your Apple TV (2nd or 3rd generation) - Apple supported

  • iPad Pro. The keyboard can be used remotely (not physically attached) or you can use a standard apple wireless keyboard

    iPad Pro. The keyboard can be used remotely (not physically attached) or you can use a standard apple wireless keyboard

    I assume that you mean the keyboard built into the 'smart cover' - it must be in contact with the iPad.

    A wireless keyboard Apple has been reported as working with an iPad Pro. Plug Apple for the new State of "magic keyboard" that it requires a Mac with os x 10.11 or later - he does not mention the iPads. Third-party Bluetooth keyboard should work.

  • I recently took a class of Microsoft and received the "Welcome" e-mail, but could not connect with the supplied credentials.

    I recently took a class of Microsoft and received the "Welcome" e-mail, but could not connect with the supplied credentials (example below):

    Your MC ID: xxxxxxx

    Your temporary access code: 18995EBE-BDAF-4883-8F95-64D18D261848

    I created a new account with the e-mail MC ID has been sent and it was not recognized.  I would like to merge (link) the news and be able to get a fresh copy of my cert.  Thank you.

    Hello

    I suggest you contact Microsoft Learning support team to improve assistance:

    http://www.Microsoft.com/learning/en/us/help/assisted-support.aspx

  • Activate the Keyboarding for guest VM without clicking the window innto

    Hello

    I've set up an Ubuntu guest on a Windows 7 host machine, and I'm very happy with it. However, I have a problem:

    When I switch to VMWare Workstation by using the keyboard (Alt - Tab), I can not immediately entered anything in the comments via the keyboard. I always first click in the window.

    To make it more clear: what I do when I use a different program on the Windows host:

    1 alt - Tab for VMWare Workstation

    2. click in the window workstation

    3. use the keyboard to interact with comments

    What I want to do:

    1 alt - Tab for VMWare Workstation

    2 use the keyboard to interact with comments

    How can I make that happen? I would also welcome to use the keyboard, for example, press ENTER to be bale to use comments.

    Ahh, I think that I figured it by myself:

    There is a menu entry "Keyboard Grab", that is mapped to Ctrl-G.

    So I have to do the following:

    1 alt - Tab for VMWare Workstation

    2. press on Ctrl-G

    3. use the keyboard to interact with comments

  • slide show by using the keys on the keyboard for nav in flash professional CS5 with animated images

    recently, I discovered how to create a slideshow using the keys on the keyboard for the market front and rear in flash professional CS5 thanks entirely to kglad of this forum. I used still images for each slide, since, then with one of the slides, I added a slight undulation of water in one of the images in a separate document. is it possible to include this file in my slideshow now?

    original questions and answers using still pictures below

    I'm a graphic designer who has a presentation of my portfolio. I'm not too experienced in flash and do not use it much, but he needs to do this on the thing. I can do a fade in and out slide show, but I want to create a slide show where the screen remains out of the blade and does ' t until what I press the next or previous button. I don't want these keys on the screen, I want to be able to press a key on the keyboard as F1. is this possible and do you know in adobe flash Professional (or other adobe products) where I could get resources/tutorials to do. Any help so what would never be great.

    response

    create tweens to fade for each slide.  You'll probably want to fade out the image on image 1 (from frames 1 to 11).  Bland-in the image of frame 11 frame 1 to 11.  fade the image frame 11 11 to 21 etc.

    You can then use:

    var image: int = 1;

    var dir:uint;

    stage.addEventListener (KeyboardEvent.KEY_DOWN, downF);

    function downF(e:KeyboardEvent):void {}

    {if(e.keycode==Keyboard.Left)}

    dir = Keyboard.LEFT

    Frame = Math.Max (Frame-10, 1);

    this.addEventListener (Event.ENTER_FRAME, nextF);

    } else {if(e.keyCode==Keyboard.RIGHT)

    dir = Keyboard.RIGHT;

    Frame = Math.min (this.totalFrames, Frame + 10);

    this.addEventListener (Event.ENTER_FRAME, nextF);

    }

    }

    function nextF(e:Event):void {}

    {if(dir==Keyboard.Left)}

    prevFrame();

    } else {}

    nextFrame();

    }

    {if(this.currentFrame==Frame)}

    this.removeEventListener (Event.ENTER_FRAME, nextF);

    }

    }

    you have the fla that created the swf file?

    If so, just copy images from this fla and paste into a new movieclip in your fla slideshow.  Add this movieclip to your timeline.

  • The drivers for this device are not installed. (Code 28) __This device is not present, is not working properly or is not all its drivers installed. (Code 24)

    I HAV these two errors in my drivers and windows cannot update, can any body healp me?

    Hello

    What devices are - if you can not tell what is the name, then you can specify the category of
    Device Manager - or both?

    --------------------------------------------------------------------------------------------------------------------

    This device is not present, is not working properly or is not all its drivers installed. (Code 24)

    The device doesn't seem to be present. The problem may be a faulty hardware or a new driver might be needed.

    Devices to stay in this State if they have been prepared for removal. After you remove the device, this error disappears.

    On theGeneral properties of the device tab, clicktroubleshoot to start the Troubleshooting Wizard.
    ---------------------------------------------------------------------------------------------------------------------
    The drivers for this device are not installed. (Code 28)

    To install the drivers for this device, clickset to update driver, which starts the Hardware Update Wizard.

    ==================================================================

    Those who might be ghosts then right click on them and UNINSTALL - devices and then RESTART.

    References to Vista also apply to Windows 7.

    If they show upward then try to manually install the drivers.

    This is my generic how updates of appropriate driver:

    This utility, it is easy see which versions are loaded:

    -Free - DriverView utility displays the list of all device drivers currently loaded on your system.
    For each driver in the list, additional useful information is displayed: load address of the driver,
    Description, version, product name, company that created the driver and more.
    http://www.NirSoft.NET/utils/DriverView.html

    For drivers, visit manufacturer of emergency system and of the manufacturer of the device that are the most common.
    Control Panel - device - Graphics Manager - note the brand and complete model
    your video card - double - tab of the driver - write version information. Now, click on update
    Driver (this can do nothing as MS is far behind the certification of drivers) - then right-click.
    Uninstall - REBOOT it will refresh the driver stack.

    Repeat this for network - card (NIC), Wifi network, sound, mouse, and keyboard if 3rd party
    with their own software and drivers and all other main drivers that you have.

    Now in the system manufacturer (Dell, HP, Toshiba as examples) site (in a restaurant), peripheral
    Site of the manufacturer (Realtek, Intel, Nvidia, ATI, for example) and get their latest versions. (Look for
    BIOS, Chipset and software updates on the site of the manufacturer of the system here.)

    Download - SAVE - go to where you put them - right click - RUN AD ADMIN - REBOOT after
    each installation.

    Always check in the Device Manager - drivers tab to be sure the version you actually install
    presents itself. This is because some restore drivers before the most recent is installed (sound card drivers
    in particular that) so to install a driver - reboot - check that it is installed and repeat as
    necessary.

    Repeat to the manufacturers - BTW in the DO NOT RUN THEIR SCANNER device - check
    manually by model.

    Look at the sites of the manufacturer for drivers - and the manufacturer of the device manually.
    http://pcsupport.about.com/od/driverssupport/HT/driverdlmfgr.htm

    Installation and update of drivers to 7 (update drivers manually using the methods above is preferred
    to make sure that the latest drivers from the manufacturer of system and device manufacturers are located)
    http://www.SevenForums.com/tutorials/43216-installing-updating-drivers-7-a.html

    If you update the drivers manually, then it's a good idea to disable the facilities of driver under Windows
    Updates, that leaves about Windows updates but it will not install the drivers that will be generally
    older and cause problems. If updates offers a new driver and then HIDE it (right click on it), then
    get new manually if you wish.

    How to disable automatic driver Installation in Windows Vista - drivers
    http://www.AddictiveTips.com/Windows-Tips/how-to-disable-automatic-driver-installation-in-Windows-Vista/
    http://TechNet.Microsoft.com/en-us/library/cc730606 (WS.10) .aspx

    I hope this helps.

    Rob Brown - MS MVP - Windows Desktop Experience: Bike - Mark Twain said it right.

  • Can I turn off the sound for a website but not computer?

    I like to play POGO games all of which come with a certain type of sound effects, but at the same time, I like to listen to my radio station streaming favor. How can I disable the sound for Web sites but not my music streaming?

    If it is an individual, video or audio on a web page, you can try to turn off or disable the audio using the audio and video controls on the web page, or you can install an extension that adds this functionality. It is called mute, and you can install it from https://addons.mozilla.org/en-US/firefox/addon/muter/

  • the procedure entry point NSSUTIL_EscapeSize could not be located in the dynamic link library nssutil3.dll

    Windows XP with Firefox 18.0.1 does not open when upgraded to the latest version.
    Error messages have been
    (1) the procedure entry that point pr_setcurrentthreadname could not be located in the dynamic library (2) ndpr4.dll the procedure entry point NSSUTIL_EscapeSize could not be located in the dynamic links (3) library nssutil3.dll was not able to load XPCOM

    A ran malware & anti-virus software then deleted Firefox via Control Panel, then residual file file C:\Documents & Folders\ApplicationData\Mozilla Director and program folder.
    Local & installed products ndpr4.dl and nssutil3.dll - fresh reinstall firefox several times - he got rid of the error message 1 but not 2 or 3 always cannot open Firefox.
    All solutions?

    I have this problem and I use Zone Alarm Extreme Security with Force active field. I found that by turning off the virtual Cache in Zone Alarm that this problem has disappeared and has been able to restart firefox.

    Here is a post I found that addresses the issue in some way. http://KB.mozillazine.org/Browser_will_not_start_up#Firefox_does_not_start_after_updating_with_ZoneAlarm_ForceField_enabled

  • the procedure entry point GetFinalPathNameByHandleW could not be found in KERNEL32.dll dynamic link library

    Hello

    While trying to install a program, I see the following on the screen error message:

    The procedure entry point GetFinalPathNameByHandleW could not be found in KERNEL32.dll dynamic link library

    The I set him, is a Windows XP 32-bit environment.

    The I am installing, is a program, created by my own company, using a 32-bit self-extracting installer, which is also created by my own business using InstallAnywhere Flexera software.

    No changes were made on the environment of the installers.

    No change seems is done on the environment for creating installation programs (where the self-extracting installer is created): I checked the monitor of reliability/Action Center / Control Panel and no entries are present between a job and an installer without work.

    The file 'KERNEL32.dll' is mentioned in the error message, I checked his date of change, which is 11/30/2012, this should not be the cause of the problem either.

    Witnin the self-extracting installation program, a few changes were found, those who are considered at the moment, but there is no indication or not those who are causing the error message I see here.

    Does anyone have an idea what may cause the error message mentioned and how to cope?

    Thank you

    Dominique

    These types of error messages mean that the program is looking "inside" the file specified (in this case kernel32.dll) try to find a function/procedure to run called "GetFinalPathNameByHandleW" and find do not.

    The program calls the non-existent function badly or the library file is not in there.  Things do not match somewhere.

    A DLL is a library of dynamic links and files as kernel32.dll are sometimes just a bunch of procedures/functions/subroutines and all located in a single, portable file.

    In a primitive way, you can use a text editor to open the kernel32.dll file (make a copy if it your desire) and search for a string "GetFinalPathNameByHandleW" and you will not find.

    You can even search for "GetFinal", and you won't find it in the XP kernel32.dll file:

    But if you do the same thing on a Windows 7 + kernel32.dll you 'll find:

    If your program calls a function inside a DLL, but this feature does not exist in the Windows XP's kernel32.dll file.

    I think that GetFinalPathNameByHandleW was introduced in Windows Vista, so now here you would be fine.

    If who wrote your program is that it works on XP, they need to stick to the functions that are part of XP and GetFinalPathNameByHandleW isn't here, where the error.

  • How to access the USB secure key on windows vista, I get the message that application 10004 could not find any JumpDrive Secure device connected to your system

    Original title: how access key USB secure Windows vista

    I have a lexar player sure to jump that I used with an old computer that has Windows XP.  I now have a new computer with Windows Vista and I can't access the secure part of the USB key.  When I try to access the part secure the USB key I have the following message "Application [-10004] could not find any JumpDrive Secure device connected to your system. Please make sure that your JumpDrive Secure device is inserted into a USB port".

    Of course, the USB key is inserted into the USB port.  If anyone can help find me a way to access the part secure the USB key I would appreciate it.  Thank you.

    Hi Jon0909,

    The error that you received can be for several reasons. I suggest you try the following steps:

    Method 1: Run the fixit available in the link below and check if that makes a difference

    Tips for solving problems of USB devices

    Method 2: This normal matter as a result of a conflict between the USB and other USB (Universal Serial Bus) connected to the computer.

    (a) disconnect all the external devices connected to the computer to expect the mouse and keyboard, check if your USB key works.

    (b) If this solves the problem, and then add back both devices until you discover the piece of hardware causing the issue.

    If the problem persists, you can contact the manufacturer of the device for any known issues
    http://www.Lexar.com/support

    Thank you, and in what concerns:

    Ajay K

    Microsoft Answers Support Engineer
    ---------------------------------------------------------------------------------------------------------
    Visit our Microsoft answers feedback Forum and let us know what you think.

Maybe you are looking for

  • Yosemite reinstall after deletion

    Hi help would be much appreciated since it is quite frustrating! So I bought a 2nd hand macbook late 2008 off ebay and everything was allowed off the coast. I selected the default option to reinstall yosemite, I agree terms and conditions, I get my a

  • binary continuous record and then converted to the spreadsheet

    Hello I'm trying to save time without interruption loop of stamps in a binary file with each iteration of a while, and then when the code is stopped, I would like this file converter to a csv file.  I have an application problem, could someone point

  • Download pdf to excel to analysis?

    PDF files will not scan when I use the data command, the text columns. It separates into rows well but the PDF file has too many columns. They come off of the worksheet. Most of the data is not readable.

  • BlackBerry Desktop Software was accompanied by a problem and must close

    I downloaded 601_b021_multilanguage.exe and installed. When I try to run it, I get the message: BlackBerry Desktop Software has encountered a problem and needs to close. EventType: clr20r3 P1: rim.desktop.exe P2: 6.0.1.18 P3: 4cfdab9cP4: microsoft.pr

  • Can not access the updates after clean install of Windows 7 Pro

    I have formatted my hard drive digital, preformed a clean install of Windows 7 Pro. Everything went well and OS seems to be properly authenticated. The question is not able to 'find' updates.  At startup, the message: NEW UPDATES AVAILABLE. When I ch