Actionscript 3 for exiting android app when you click home button???

Can anyone help?
I've created an andriod app in flash and need it to exit when the user clicks the home button. I found the following actionscript 3 online
// Check if we are on a Android / iPhoney device.
if(Capabilities.cpuArchitecture=="ARM")
    NativeApplication.nativeApplication.addEventListener(Event.ACTIVATE, handleActivate, false, 0, true);
    NativeApplication.nativeApplication.addEventListener(Event.DEACTIVATE, handleDeactivate, false, 0, true);
    NativeApplication.nativeApplication.addEventListener(KeyboardEvent.KEY_DOWN, handleKeys, false, 0, true);
private function handleActivate(event:Event):void
    NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.KEEP_AWAKE;
private function handleDeactivate(event:Event):void
    NativeApplication.nativeApplication.exit();
private function handleKeys(event:KeyboardEvent):void
    if(event.keyCode == Keyboard.BACK)
    NativeApplication.nativeApplication.exit();
However I'm getting errors at lines starting with "private function handle" saying "The private attribute may be used only on class property definitions."
I'm new to actionscript 3 so I'm not sure what this means. Can anyone help? Or does anyone have a piece of script that definitely works.

Just remove the private keyword becoz that has to use only for package with class, I hope you written your code on timeline.
function handleActivate(event:Event):void
    NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.KEEP_AWAKE;
function handleDeactivate(event:Event):void
    NativeApplication.nativeApplication.exit();
function handleKeys(event:KeyboardEvent):void
    if(event.keyCode == Keyboard.BACK)
    NativeApplication.nativeApplication.exit();

Similar Messages

  • After upgrading ipad to iOS 7.1 I can no longer close open apps by double clicking home button. Any other way to close open apps?

    After upgrading ipad to iOS 7.1 I can no longer close open apps by double clicking home button.  Any ideas

    Double-tap on the Home button. You will see a preview of the app above the actual icon. Slide the preview up to kill it.
    Please get the iPhone User Guide (For iOS 7 Software)Sep 19, 2013 - 23 MB.

  • Why the photo app is not closing after i finish, when i take a picture accessing directly from home screen. the location is draining my battery if I'm not closing the app by double click home button. in iOS 6 was not like this

    When im taking a picture directly from home screen after im finished the application remain open. This app is ussing the location and if im not closing like other applications by doble click the home button the batery will finished fast. On the other IOS 5 and 6 was not neccesary to unblock the phone and bouble click the home bottom.

    Reinstalling OS X Without Erasing the Drive
    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.
    Reinstalling OS X Without Erasing the Drive
    Repair the Hard Drive and Permissions: Upon startup select Disk Utility from the main menu. Repair the Hard Drive and Permissions as follows.
    When the recovery menu appears select Disk Utility and press the Continue button. After Disk Utility loads select the Macintosh HD entry from the the left side list.  Click on the First Aid tab, then click on the Repair Disk button. If Disk Utility reports any errors that have been fixed, then re-run Repair Disk until no errors are reported. If no errors are reported click on the Repair Permissions button. Wait until the operation completes, then quit Disk Utility and return to the main menu.
    Reinstall OS X: Select Reinstall OS X and click on the Continue button.
    Note: You will need an active Internet connection. I suggest using Ethernet if possible because it is three times faster than wireless.
    Alternatively, see:
    Reinstall OS X Without Erasing the Drive
    Choose the version you have installed now:
    OS X Yosemite- Reinstall OS X
    OS X Mavericks- Reinstall OS X
    OS X Mountain Lion- Reinstall OS X
    OS X Lion- Reinstall Mac OS X
         Note: You will need an active Internet connection. I suggest using Ethernet
                     if possible because it is three times faster than wireless.

  • DW CS6 - Spry collapsible panels - How to have panel close when you click away from it?

    I know typically onmouseout is used to close other items, but I could not figure it out with the spry collapsible panel. I have the panel opening onclick and closing onclick, but I would really like for it to close when you click anything else on the page outside of the panel.
    Thank you!

    Sorry, I did not mean other collapsing panels close when you click away from it. I simply meant in general for the closing after clicking away function, you can use onmouseout. I was working on something with collapsing panels and I wanted it to show the information when you clicked on it, but when you click on another panel, they both remain open. I really want both to close. I believe accordion does this, but not quite what I am looking for either.
    Here is a better example of what I would prefer: Houston Public Library
    If you visit their page and click "Find it" a box pops down with information and then when you click anywhere else on the screen, it closes that box. When you click "Research," it closes the "Find It" box and opens the "Research" box. There is likely a much better way to do this, but I am pretty new to this.
    Any assistance is very much appreciated.
    Thank you!

  • What happens when you click SUBMIT ? URGENT HELP

    Hi,
    I have a requirement where I want to know all the records that are submitted this year.
    Can anybody tell me which column gets auto populated (Vanilla funcationality) in S_EVT_ACT when we click the Submit button ??
    Thanks :-)

    Hi,
    Thanks for the help.
    I am using Siebel ePharma 7.7.2.6.
    No I will not be able to use the Start Date. I want the records submitted this year because of which I cannot use Start Date.
    In S_EVT_ACT, there is a column Call_Submit_Date. But that dosent get populated by default. I wanted to know is there any column which get populated by default (Vanilla functionality) when you click Submit button.
    Thanks :)

  • Frequent LowMemory crash when starting multitasking by double-click Home button

    After upgrading iOS 7, my iPhone 5 crashes when double-clicking home button for multitasking.
    The crush shows white apple logo and reboots my iPhone.
    It occurs about 2-3 times a day.
    Every time crash occurs, Diagnostic & Usage Data would add a LowMemory log, which is exactly the time iPhone crashes.
    Therefore I guess it's because of running out memory.
    I've tried Reset My Phone, Reduce Motion, Disable Background App Fresh..., but none of it worked.
    My iPhone begins to crash 3 days after resetting.
    Does anybody know how to solve it?

    I think you mean crash.
    Also, I am going to assume you've tried restarting and reseting. What you can do is back up the important information in your phone (using either iTunes or iCloud) and restore the device as new. Then, you can restore from your backup. This will remove any and all software bugs.

  • Cp8 Is it possible to initiate a different timeline to start playing once you click a button?

    A bit challenging to explain, but I'll give it a shot:
    If we take a rollover slidelet for example - It has its own "timeline" so you can basically display additional objects on screen separately from the main timeline.
    Is it possible to have the same effect when you click a button?
    So basically i want certain object to appear one after the other after I click a button.
    Thanks!

    Thanks for the explanation, but that's not what I meant exactly
    I'm not using any rollovers in the slide. Only buttons. The users can click on any button if they wish to. Once a button is clicked, I want certain objects to appear.
    I'm using advanced actions in order to display a group and hide the others. So when a user clicks on say button 1, group one appears on screen and the rest of the groups disappear (by the advanced action).
    The group that does appear, contain 5 elements that appear at once. I want them to appear one after the other in sync with an audio narration. I'm well aware about using the timeline to achieve this, however, the issue is that I don't have an individual timeline for the "group" (similar to the Gr_Vars) that you show in your pic. Even if I un-group it into objects then it consists of too many items to hide / show with advanced actions.

  • When you push the button VL02N that is in the  post output of goods)

    En inglés:
    Hello, in Peru is required to account when delivery by VL02N, the document is assigned a serial tax (calculated by ranges in a table z), the point is that I have not got any user exit is activated when you push the button VL02N that is in the (post output of goods), I reviewed the user exit and is not active MV50AFZ1 the button and the methods of the badi LE_SHP_DELIVERY_PROC (transaction SE18) were not actively using the button to count the output of goods VL02N transaction delivery
    Would know as one might do this?
    thanks and regards
    En español:
    Hola, en Peru se necesita que cuando de contabilize la entrega por la VL02N, se asigne al documento un consecutivo fiscal (calculado por rangos en una tabla z), el punto es que no he conseguido ningun user exit que se active cuando presiono el boton que está en la VL02N , (contabilizar salida de mercancias), revisé el user exit MV50AFZ1 y no se activa en el botón y los métodos de la badi LE_SHP_DELIVERY_PROC ( transacción se18) tampoco se activam con el botón de contabilizar la salida de mercancia en la transacción VL02N  de la entrega
    Sabrian como se podria hacer esto?
    gracias y saludos

    Hi,
    you can use the BADI " LE_SHP_GOODSMOVEMENT" in SE18 implement and see we have the Parameter IS-LIKP using which you can put values.
    Regards

  • Which form will be submitted when i click refresh button.

    HI,
    which form will be submitted when i click on refresh button.

    When you click refresh button, it will send to the server the exact same request that it sent to get to the current page.
    If the previous navigation was done by a form submission, then yes, that form submission will be repeated.

  • Final cut pro x - lion - mbp 2011 2.0 15 - not responding at all since latest update. Can't open or edit projects, loading window that pops us when you click the app (as it loads) does not go away, says loading compressor support.  Have tried reinstalling

    final cut pro x - lion - mbp 2011 2.0 15 - not responding at all since latest update. Can't open or edit projects, loading window that pops us when you click the app (as it loads) does not go away, says loading compressor support, paralyzed.  Have tried reinstalling, default settings etc
    Appreciate suggestion, working on deadline. Thanks.  

    Here is the start of the crash report:
    Process:         Final Cut Pro [20568]
    Path:            /Applications/Final Cut Pro.app/Contents/MacOS/Final Cut Pro
    Identifier:      com.apple.FinalCut
    Version:         10.0.1 (185673)
    Build Info:      ProEditor-185670300~1
    App Item ID:     424389933
    App External ID: 4138831
    Code Type:       X86-64 (Native)
    Parent Process:  launchd [102]
    Date/Time:       2011-11-11 20:41:32.201 -0800
    OS Version:      Mac OS X 10.7.2 (11C74)
    Report Version:  9
    Interval Since Last Report:          192058 sec
    Crashes Since Last Report:           14
    Per-App Interval Since Last Report:  157161 sec
    Per-App Crashes Since Last Report:   14
    Anonymous UUID:                      DD542B2F-58A0-482E-AAFA-ECADEC76F562
    Crashed Thread:  0  Dispatch queue: com.apple.main-thread
    Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
    Exception Codes: KERN_INVALID_ADDRESS at 0x0000000280000003
    VM Regions Near 0x280000003:
        CG shared images       00000001cbf62000-00000001cc182000 [ 2176K] r--/r-- SM=SHM 
    -->
        STACK GUARD            00007fff5bc00000-00007fff5f400000 [ 56.0M] ---/rwx SM=NUL  stack guard for thread 0
    Application Specific Information:
    objc[20568]: garbage collection is OFF

  • Blackberry App World won't open when you click on icon

    Blackberry App World won't open when you click on icon, I have done reboot and batt pull and redownloaded - any ideas

    Hello scottex968, 
    Welcome to the forums. 
    In this case we can try to reload the software on the BlackBerry® smartphone to make sure it is running the latest version and there are no issues with the OS.
    Here is how to backup your BlackBerry smartphone http://bbry.lv/oPVWXc
    Once you have backed up your BlackBerry smartphone please follow the link below to complete a clean reload of the BlackBerry smartphone software.
    Link: http://www.blackberry.com/btsc/KB03621
    Once completed test it and proceed with a selective restore, here is how to restore http://bbry.lv/qgQxLo
    Thank you
    -SR
    Come follow your BlackBerry Technical Team on twitter! @BlackBerryHelp
    Be sure to click Kudos! for those who have helped you.Click Solution? for posts that have solved your issue(s)!

  • When you download an app is it downloaded when it fully loads or when you click buy?

    Hi Guys,
    I was wondering:
    When you download an app does it count as a download when you click
    buy app or when it fully loads?
    Thanks

    There is nothing anyone else here can say. None of us work for Apple, and only Apple knows exactly at what point they register the purchase for the purposes of the contest. All we know is what Apple states in their official rules:
    http://www.apple.com/itunes/25-billion-app-countdown/rules/index.html
    and they don't say exactly when the purchase is recorded.
    Again, you'll just have to take your best shot.
    Good luck.

  • Please help. My facebook app will not open on my iphone 4. I deleted it,numerous times and downloaded it again. It uploads, but when you click on the icon, it flickers then closes.  Help.

    Please help. My facebook app will not open on my iphone 4. I deleted it,numerous times and downloaded it again. It uploads, but when you click on the icon, it flickers then closes.
    Help.

    Then the next step would be to restore your phone.  My advice is that prior to restoring you import your photos and videos to your computer and back up your contacts (by syncing them with iCloud or to a supported program on your computer using iTunes) as a number of users report losing these when restoring their device.

  • Hi there, Can you please HELP ME? I created a signature for my email account, but I can not choose it because the option is daded under "none"and nothing happens when you click on it! Thank you, Johan

    Hi there, Can you please HELP ME? I created a signature for my email account, but I can not choose it because the option is daded under "none"and nothing happens when you click on it! Thank you, Johan

    This can be a problem with the file places.sqlite that stores the bookmarks and the history.
    * http://kb.mozillazine.org/Bookmarks_history_and_toolbar_buttons_not_working_-_Firefox

  • Can you have a DIAdem file embedded in a web app and then when you click the link to the DIAdem file it invokes DIAdem?

    Can you have a DIAdem file embedded in a web app and then when you click the link to the DIAdem file it invokes DIAdem?

    Hello JCN,
    I will keep in touch with the current Applications Engineer who will be assisting you with this issue and update the forum with the status of the problem. I personally think that your best option would be to create a link that opens DIAdem and then runs a script to load the data from a predetermined file (Rather than a link to the file itself).
    Ian M.
    National Instruments

Maybe you are looking for