Android 5.0 - Lollipop On Monday, January 4, 2016 at 6:14:25 AM UTC-7, Dario Dorando wrote: > > On which Android Version? > > > > Gesendet von Mail <http://go.microsoft.com/fwlink/?LinkId=550986> für > Windows 10 > > > > > *Von: *Eric Risdall <javascript:> > *Gesendet: *Montag, 4. Januar 2016 04:35 > *An: *Android Developers <javascript:> > *Betreff: *[android-developers] How to stop an applications music/sound > whenHOME button is pressed? > > > > I am developing an app in Flash Professional CS5.5 & Actionscript 3 for > the Android phone. When I hit the HOME button to exit the app, the > background music keeps playing. I have already tried the following two > methods: > > > > METHOD 1: > > package > { import flash.display.Sprite; > import flash.events.Event; > > public class Main extends Sprite > { public function Main():void > { stage.addEventListener(Event.ACTIVATE, onAppActivated); > stage.addEventListener(Event.DEACTIVATE, onAppDeactivated); > } > > private function onAppActivated(e:Event):void > { // Play audio > } > > private function onAppDeactivated(e:Event):void > { // Stop audio > } > } > } > > > > METHOD 2: > > package > { import flash.desktop.NativeApplication > import flash.events.KeyboardEvent; > > public class Main extends Sprite > { public function Main():void > { > NativeApplication.nativeApplication.addEventListener(KeyboardEvent.KEY_DOWN, > onKeyDown); > } > > protected function onKeyDown(e:KeyboardEvent):void > { if(e.keyCode == Keyboard.HOME) > { //stop audio. > } > } > } > } > > > > Neither method works for stopping the audio & frankly i'm at a loss as for > how to proceed here. Is there any way to override the home key? or maybe > there is something I can add to the XML manifest for the app? (something > like <key>UIApplicationExitsOnSuspend</key><true/>]]>?) > > -- > You received this message because you are subscribed to the Google Groups > "Android Developers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] <javascript:>. > To post to this group, send email to [email protected] > <javascript:>. > Visit this group at https://groups.google.com/group/android-developers. > To view this discussion on the web visit > https://groups.google.com/d/msgid/android-developers/ebcfa486-b6c3-4bd2-a564-c097713bbac7%40googlegroups.com > > <https://groups.google.com/d/msgid/android-developers/ebcfa486-b6c3-4bd2-a564-c097713bbac7%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > > >
-- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/android-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/android-developers/09c317dc-614f-48d5-a567-cb879a5d6d4f%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

