Detect a keyboard press in flash.. help!

This is my code..
An error appears :Incorrect Number of arguments Expected 1       Source:  detectKey();
can anyone help me whats missing in my code tnx:
stop();
loaderInfo.addEventListener(ProgressEvent.PROGRESS,updateloader);
stage.addEventListener(KeyboardEvent.KEY_DOWN, detectKey);
function detectKey(event:KeyboardEvent):void {
   if(event.keyCode==13){
    gotoAndStop("contact");
function updateloader(e:ProgressEvent){
var percentloaded:Number=Math.floor((e.bytesLoaded*100)/e.bytesTotal);
txtloader.text=percentloaded+"%";
if(percentloaded==100){
detectKey(); // here's the error

Try making the argument an optional element...
function detectKey(event:KeyboardEvent=null):void {

Similar Messages

  • AW keyboard focus after Flash interaction

    Hi all and happy new year!
    I am using AW7.02, Windows XP, Flash v8 (loaded using
    ActiveX).
    I have the following setup:
    In a pageturner made in AW I have an interaction icon placed
    inside a
    Framework. On the interaction icon I have several perpetual
    buttons, one in
    particular to flip to the next page (next icon on framework).
    This button
    interaction has RightArrow and PageDown keys assigned to it.
    So, while
    running, if I hit right arrow or page down I will flip to
    next page. This
    works fine.
    I also load and display Flash on the pages using ActiveX
    (Shockwave Flash
    Object). The Flash are animations, so the user can click on
    Flash
    controllers to play/pause etc.
    The problem:
    So, user can flip to next page with keyboard just fine, as
    long as the user
    does not hit anything in the Flash ActiveX first. So for
    example, if the
    user pauses the movie clicking the pause button in the Flash
    ActiveX and
    then hit the right arrow key, then nothing happens. (I want
    page to be
    turned). The user must first hit somewhere outside the Flash
    ActiveX in the
    AW window before the keyboard triggers the buttons again.
    Attempts:
    All my attempts have only been in author mode and not
    packaged mode.
    I've done some attempts sending event from Flash after button
    in Flash has
    been pressed. This is picked up by AW (confirmed with trace)
    and then I've
    tried to:
    - set focus to interaction icon that holds the button using
    SetKeyboardFocus(InteractionIconID). Did not work.
    - set window focus using baActivateWindow(baWinHandle) (from
    Buddy API). Did
    not work, and as far as I could see the active window
    remained the same (=
    AW window) during Flash interaction, so probably not so
    strange it didn't
    work.
    So, does anyone have any idea on how I can fix the focus
    problem? The only
    workaround that I am left with right now is to set up the
    same keyboard
    interaction in the Flash as in the AW and send this info back
    to AW as
    events. This is not ideal due to update issues and unclear
    codestructure.
    /Jensen/

    Hi again!
    Just a little update.
    I tried to package, but that didn't help.
    So I went for the the workaround where I pick up keyboard
    pressing in Flash
    and send this info back with fscommand:
    FSCommand("keypress", Key.getCode());
    I pick up the event in AW and filter it with keypress as
    #command. I then
    get the key code from the #arg list and have a property list
    where I link
    the key code with the keyname used in AW. I then use the
    KeyPress function
    as suggested by Erik. As a result, any updates I make to what
    the different
    keys do needs only be done in AW, so I guess it isn't too
    bad.
    Thanks for help and tips!
    /Jensen/
    "Erik **AdobeCommunityExpert**"
    <[email protected]> wrote in
    message news:[email protected]...
    >I hesitate to post this as it might be a pain, as you
    suggest, and others
    >may have a better suggestion...
    > But I think you'll have to setup a detection of the
    keypresses in Flash
    > and send those as Events to Authorware. When Authorware
    picksup those
    > events, have it do a 'press key' for the button to
    activate the
    > appropriate one (I generally us F1 keys or shift-number
    keys !@#$%^).
    > Erik
    >
    > Jensen wrote:
    >> Hi all and happy new year!
    >>
    >> I am using AW7.02, Windows XP, Flash v8 (loaded
    using ActiveX).
    >>
    >> I have the following setup:
    >> In a pageturner made in AW I have an interaction
    icon placed inside a
    >> Framework. On the interaction icon I have several
    perpetual buttons, one
    >> in particular to flip to the next page (next icon on
    framework). This
    >> button interaction has RightArrow and PageDown keys
    assigned to it. So,
    >> while running, if I hit right arrow or page down I
    will flip to next
    >> page. This works fine.
    >> I also load and display Flash on the pages using
    ActiveX (Shockwave Flash
    >> Object). The Flash are animations, so the user can
    click on Flash
    >> controllers to play/pause etc.
    >>
    >> The problem:
    >> So, user can flip to next page with keyboard just
    fine, as long as the
    >> user does not hit anything in the Flash ActiveX
    first. So for example, if
    >> the user pauses the movie clicking the pause button
    in the Flash ActiveX
    >> and then hit the right arrow key, then nothing
    happens. (I want page to
    >> be turned). The user must first hit somewhere
    outside the Flash ActiveX
    >> in the AW window before the keyboard triggers the
    buttons again.
    >>
    >> Attempts:
    >> All my attempts have only been in author mode and
    not packaged mode.
    >> I've done some attempts sending event from Flash
    after button in Flash
    >> has been pressed. This is picked up by AW (confirmed
    with trace) and then
    >> I've tried to:
    >> - set focus to interaction icon that holds the
    button using
    >> SetKeyboardFocus(InteractionIconID). Did not work.
    >> - set window focus using
    baActivateWindow(baWinHandle) (from Buddy API).
    >> Did not work, and as far as I could see the active
    window remained the
    >> same (= AW window) during Flash interaction, so
    probably not so strange
    >> it didn't work.
    >>
    >> So, does anyone have any idea on how I can fix the
    focus problem? The
    >> only workaround that I am left with right now is to
    set up the same
    >> keyboard interaction in the Flash as in the AW and
    send this info back to
    >> AW as events. This is not ideal due to update issues
    and unclear
    >> codestructure.
    >>
    >> /Jensen/
    >
    > --
    > Erik Lord
    >
    http://www.capemedia.net
    > Adobe Community Expert - Authorware
    >
    http://www.adobe.com/communities/experts/
    >
    >
    http://www.awaretips.net -
    samples, tips, products, faqs, and links!
    > *Search the A'ware newsgroup archives*
    >
    http://groups.google.com/group/macromedia.authorware

  • I am new to iphones and went to Itunes and it said my new iphone needed a software update. Now the apps that I put on wont work and when pressed just flash on then off the screen. I paid £20 for one of them so any help would be appreciated.

    I have a new iphone and went into Itunes and it said my new iphone needed a software update. I let it do this and now the apps that I put on won't work and when pressed just flash on then off the screen. I paid £20 for one of them so any help would be appreciated.

    Memory Map:  http://www.memory-map.co.uk/iphone/
    0870:  http://www.simonmaddox.com/
    Viber:  http://support.viber.com/home
    VoucherCloud: http://questions.vouchercloud.com/

  • Take printscreen and detect mouse/keyboard input

    hi guys,
    I'm looking a way to take printsceen and detecting mouse/keyboard input in Adobe Air app using html/ajax .. is it possible ?
    any ideas ..please

    I wrote a blog post on how to do screen capturing using Adobe AIR abnd HTML/JavaScript. Maybe it'll help you out:
    http://www.andymatthews.net/read/2009/11/05/Capture-BitmapData-with-JavaScript-AIR-applica tions
    As for detecting key input, you can add a keydown/keydown event to the document quite easily.
    document.addEventListener('keydown', function(evt){
         // do something

  • How to create an EventListener for a specific keyboard press?

    Hello,
    I have been trying to figure out how to switch my actionscript3 from a mouse click to a keyboard press. I'm new to Flash, but the problem I keep coming to is that I need to have 3 separate keys programmed in to do three seperate outcomes. I have messed around with eventListeners for keyboard presses, but I cannot figure out how to have flash listen for a specific key press and then do an action based on that specific key press.
    Here is my actionscript. Any suggestions on how I can modify the mouse clicks to be keyboard presses, where key 's' = btn1 and triggers gotoAndPlay(2), 'g' = btn2 and triggers gotoAndPlay(3), 'k' = btn3 and triggers gotoAndPlay(4) as outline below. I also need my timer and writing to an exteral file to remain the same.
    stop();
    var startTime:Number=getTimer();
    var elapsedTime:Number;
    stream.writeUTFBytes("Item1,");
    function BTN1Action(eventObject:MouseEvent) {
         elapsedTime = getTimer() - startTime;
              stream.writeUTFBytes("Tar1,");
              stream.writeUTFBytes(elapsedTime.toString());
              stream.writeUTFBytes("\n");
              gotoAndPlay(2);
    function BTN2Action(eventObject:MouseEvent) {
              elapsedTime = getTimer() - startTime;
              stream.writeUTFBytes("Tar2,");
              stream.writeUTFBytes(elapsedTime.toString());
              stream.writeUTFBytes("\n");
              gotoAndPlay(3);
    function BTN3Action(eventObject:MouseEvent) {
              elapsedTime = getTimer() - startTime;
              stream.writeUTFBytes("Tar3,");
              stream.writeUTFBytes(elapsedTime.toString());
              stream.writeUTFBytes("\n");
              gotoAndPlay(4);
    BTN1.addEventListener(MouseEvent.CLICK, BTN1Action);
    BTN2.addEventListener(MouseEvent.CLICK, BTN2Action);
    BTN3.addEventListener(MouseEvent.CLICK, BTN3Action);
    Any assistance with this is greatly appriciated. 

    Assuming you want to monitor key press on the button BTN1, you can do following:
    // Add a key up event listener on the button (or on the source where the key press needs to be captured)
    BTN1.addEventListener(KeyPress.KEYUP, BTN1KeyUpAction);
    // BTN1KeyUpAction sample, you can modify this
    function BTN1KeyUpAction(e:KeyboardEvent):void {
        if(e.keyCode == Keyboard.S) {
        gotoAndPlay(2);

  • Sensing a keyboard press in a forms app?

    In a windows form, I have a button. When that button is pressed, I want it to look for keyboard presses. When the spacebar is pressed 10 times, I want the button to do something. Is this at all possible?
    In Calculus, 1+1=0.

    I guess that you have only one button and one label in the form so that button1 is focused by default when Form1 loads. You set button1.Enable = false, Form1.LostFocus so that keyevents do not work.
    Please try to use the following code it works well
    public partial class Form1 : Form
    int i = 0;
    public Form1()
    InitializeComponent();
    this.KeyPreview = true;
    this.KeyPress += new KeyPressEventHandler(Form1_KeyPress);
    private void button1_Click(object sender, EventArgs e)
    button1.Enabled = false;
    this.Focus();
    private void Form1_KeyPress(object sender, KeyPressEventArgs e)
    if (e.KeyChar == (char)Keys.Space)
    i += 1;
    label1.Text = "Worked !";
    if (i == 10)
    button1.Enabled = true;
    Hope above help !
    Doanh
      

  • Mac Mini 2011 Server Won't Detect Bluetooth Keyboard

    Hi all,
    My new Mac Mini Server (2011) with Lion preinstalled is causing my some headaches and it is barely out of the box. I have an Apple Wireless Keyboard and a third-party bluetooth mouse. I unpaired both from my Macbook Pro and then tried switching the MBP's bluetooth off and even turning off the whole **** machine. In the mean time, the Mac Mini's Setup Assistant could not find my keyboard, but it did find my mouse. I tried putting fresh batteries in my keyboard and everything looks fine since even my iPad can "see" the keyboard is active. However, because Setup Assistant cannot detect the keyboard, I cannot get past the Setup stage (and hopefully try fiddling with the bluetooth settings). I am compleetly stuck on the page where one has to input an Admininstor's password for the server. A mouse alone cannot get me past this part. Can anyone please please help me?
    Denis

    Start the mini looking for the keyboard then turn the keyboard off and on again (worked for me)

  • Macbook can not detect any keyboards or mouses

    My macbook can't detect any keyboards or mouses on the USB-port. USB-sticks or disks are no problem.
    A week ago there was no problem connecting everything. So today I used a USB-hub to connect my devices and mybe this was the problem.
    After connecting, the mac can't decect any keyboards or mouses also without using the hub.
    I tried:
    restart
    battery removal
    PRAM reset
    SMC reset
    But always no result.
    So what can help?
    Tanks.

    I believe it has to do with my Airport Utility on my MacBook (since the problem occers since I upgraded to the latest version). Is there any way to reinstall this App?
    EDIT: Sorry, I believe I need to read this thread http://discussions.apple.com/thread.jspa?threadID=2644274&tstart=0
    Message was edited by: Jaap74

  • G4 just replaced power supply , it powers up , but the screen is not on and the mouse and keyboard aren't on either. A few times the computer came on with screen working but then it froze up, can't do any type of reset cause of keyboard not working. Help!

    G4 just replaced power supply , it powers up , but the screen is not on and the mouse and keyboard aren't on either. A few times the computer came on with screen working but then it froze up, can't do any type of reset cause of keyboard not working. Help! Pressed pmu button already,  nothing ,..  Ppc g4 Mac

    Should I check the memory cards themselves? Reseat them?
    Yes.
    Memtest X or Rember to test the RAM.
    Reseat is also good.
    The iPhone 4 doesn't like USB 1.1 much.
    after the update the computer was working well, except for this freeze when ever I connect iPhone.
    I'd try USB 2.0 PCI. That's how I connect my iPhone 4s, and have connected all iPhones and iPods, to my G4.
    Never an issue.
    Can't say the same for USB 1.1.......
    The above (previous post) linked PCI card is cheap enough.
    Want cheaper, try this:
    http://www.amazon.com/Protronix®-5-Port-Controller-Card-Chipset/dp/B005JE2U82/re f=sr_1_2?ie=UTF8&qid=1337472141&sr=8-2
    The NEC chipset is the desired chipset, regardless of what OS the maker says is compatible.
    OS X has native NEC chipset USB support.

  • Mac mini 2009 mavericks won't boot. Blank display no logo,etc. Tried all keyboard boot functions, no help. replaced RAM w/known good. No help. Removed HD mounted in external enclosure and ran permissions and repair. No help. Upgraded HD to Yosemite a

    Mac mini 2009 Mavericks won't boot. Chimes and power light comes on. USB ports have power. Blank display no logo,etc. Tried all keyboard boot functions, no help. Replaced RAM w/known good. No help. Removed HD and mounted in external enclosure and ran permissions and repair. No help. Upgraded HD to Yosemite and was able to boot another mini from HD mounted in external enclosure, reinstalled HD still no boot. Any ideas on how to proceed appreciated.

    - Make an appointment at the Genius Bar of an Apple store. You have a hardware problem.
      Apple Retail Store - Genius Bar

  • Why is Flash Help/Search function so worthless?

    Is it just me or is the Flash help function the worst help
    function ever?
    In other software you get the results you were looking for in
    seconds
    in Flash everytime you do a search you get like a hundred
    different
    search results and usually none cover the topic you were
    looking for.
    Its often easier to search on google than use the internal
    help function
    Why is it so hard to only display relevant results?
    Could anyone teach me how to use the search function cause I
    dont want
    to read 1000 pages just to find out the difference between
    align and distribute
    options etc.
    Thx /AquaStealth

    It seems this article was written just for you! :)
    http://www.communitymx.com/content/article.cfm?cid=01B54

  • Acrobat reader mouse and  pointer change by keyboard press

    Hey i need to change mouse and  pointerby keyboard press.
    When i have "pointer" and press "space" i can't move page...
    but the mouse shows up.
    9.5.0

    Up, why this is still without answer ?!
    you can tell me in
    11.0.9
    i don't care :/

  • Hp dv5-1021et keyboard press double button at same time

    my keyboard press some of the keys at same time. I tried every software update.
    these key are "z1""x2""c3""v4""m7""ö8""ç9"".0""space+arrow down""END+arrow left"
    there is not a tech.sup. neer my area, I changed my keyboard my self but same problem ramains.  Keys work perfecly USB keyboard. It started a few days ago and I couldnt fix it.
    (there is not a broken pin or something like that on flex wires.)
    What can I do for it???

    Did you find a solution, I hav4e the sam7e problem7 now as you c3an seeZ!

  • TS4062 ive recently updated my IOS, which deleted my music and apps, and it is now not allowing me to press sync, any help?

    ive recently updated my IOS, which deleted my music and apps, and it is now not allowing me to press sync, any help?

    The next iOS update won't change this.
    Are you able to transfer anything else from your iTunes library and computer via the iTunes sync process such as a movie, TV show, podcast, audio or print book, apps, and photos from your computer?
    What is selected under the Music tab for your iPhone sync preferences with iTunes.

  • Why is Logic Express 8 keep stopping after 2 sec, every time I press play? Help!!!

    Why is Logic Express 8 keep stopping after 2 sec, every time I press play? Help!!!

    Its likely to be caused by Ozone5.. many people have reported that plugin is currently quite unstable and are awaiting updates from izotope to fix the problem... No ETA has been given by izotope for the fix however...
    Also several of your plugins are out of date (Zebra2, Clariphonic, Ozone itself.. to name but a few,)
    Finally, you are running an older version of Logic Pro X (10.0.3)...and  I would normally suggest you update to the latest version  but... if you have a USB2 audio interface do not update to 10.0.5 at this time.... unless you know it will work correctly with the new version of LPX.

Maybe you are looking for

  • The feature i am trying to use is on a network resource that is unavailible

    when i try to update my itunes from ver. 7.1 to ver 7.5 it says that..the feature i am trying to use is on a network resource that is unavailible then gives me the option to browse and locate a alternate path to a folder containing the installaiton p

  • Does anyone know how to get one drop down populate multiple drop downs in adobe form not live cycle!

    I have one drop down that when value selected another drop down is filled with list of choices, and then one of those choices is made another drop down should be populated with some choices. ish

  • ISight V.3 - user did not respond - US to UK

    Hi there, I am beset with the same problems as so many of you are it seems with ISight. I am trying to video conference with someone across the Atlantic with no joy. I use a DSL line here at my office, have bonjour as well as AIM open and can ichat f

  • Sequence of dependencies in product spec

    Hi, Does the sequence of dependencies that I enter in the product spec dependencies tab matters ? Ex: FromComponent ToComponent A B B C FromComponent ToComponent B C A B Does the upper two configurations are same ? Thanks, Harman

  • Need help searching for a good IDE...

    I've been looking for a good Java IDE that is somewhat comparable to Visual Studio 2003 regarding parameter info helpers and syntax highlighting, with an thought of visual design too. Does Sun have an IDE similar to VS? Seems like I came across one o