Is it possible to pause my flash app on iphone by pressing home button? - iphone

I'm quite new to Flash. So here's my problem: I've created my app and it works great. But when I press home button on my iphone, my app minimizes and when I open it from multitasking apps, it simply restarts. Is it possible to freeze or pause the game instead of stop? Thanks!

By default the application should be eligible for the 'freeze-drying' iOS4+ functionality that resumes an app from the last place it left off. That may require a setting to be adjusted in your app descriptor (UIApplicationExitsOnSuspend should be false).
If you simply need to save data when the application is quitting, you can listen for Event.EXITING on the NativeApplication:
NativeApplication.nativeApplication.addEventListener(Event.EXITING, onExit);

Related

iphone lock button and the running app

this may be a simple one, but I don't know the answer.....
For testing whether my location-based app receives updates in background, I usually run the app and then press the Home button to put the app in background. However, I am curious whether pressing the Lock button (at the top) will put the app in background or not.
Regards.
Yes. Hitting the lock button does background the application. However when you unlock it, the application is then brought back to the foreground. Should be able to test this within your App Delegate and simple log statements.

Play splash movie every time app launch (with multi-task support)

the app I'm working on supports iOS multi-task feature by default, and I want to stick with this.
Upon app launch, a splash movie clip is played (code is in AppDelegate), after user hits the home button, and re-launches the app, I want to the same splash movie be played before showing the last view where use was.
I know by switching off the multi-task support, I can achieve this, but in the meanwhile, I'm losing the multi-task support feature, and I need to write code to save/resume user states. So, is there any workaround for this? thanks!
You could try the app delegate's applicationDidBecomeActive: method but quite frankly I'd consider this to be user hostile behaviour. Who wants to see a movie every time they switch between apps? The point of multitasking on the iPhone is to quickly change between apps and this violates that.

IPhone: Why does my app resume and not restart when I relaunch it on device?

I don't know if this is an iOS4 thing or something, but basically say I have a few screens in my app. Now, when I hit the home button and relaunch my app it launches the app on the screen where I left off. It's almost like it's not restarting my app, but resumes it. I don't want it to do that. (I'd like it to show my splash screen main menu, etc. )
Does anyone know how to resolve this? thanks
In iOS 4, apps are suspended (not terminated) when the home button is pressed. When you "relaunch" the app, it is simply moved to the foreground. If you want your app to terminate when the user presses the home button, set the value of UIApplicationExitsOnSuspend to YES in your app's Info.plist file. If you do this, when the user taps the home button the applicationWillTerminate: method of your app delegate will be called and then your application will terminate.
I think this should help you. Basically what you need to do is disable the multi-tasking features of iOS4.
http://www.iphonedevsdk.com/forum/iphone-sdk-development/60989-disable-multi-tasking-ios4-application.html
That's exactly the multi-tasking you asked about yesterday working behind the scenes. You need to opt-out if you want that behavior. See answers to your previous question here. Have you read the answers there???

Home button doesn't exit app in iPhone simulator 4.0

I noticed that when building then running viewDidLoad only gets called once. If you press the home button and re-enter the application, viewDidLoad does not execute again.
Another thing I noticed is that when you re-enter an application it starts off right where you left off.
Is this the same behavior as in older SDKs? Does this mean that when the home button is pressed the application did not really exit?
When you press the home button, debugging is terminated and therefore you will not see anything from NSLog in the debugger console on any version of the SDK. You can try this by putting an NSLog in viewDidAppear:, which should get called even if the app is still running in the background in iOS 4, but doesn't
One difference with iOS4.0 is that if you press the home button your app might not necessarily terminate. The default setting is that they that will still be loaded in memory. This is the new 'multi-tasking' feature of iOS4.0. Turn it off and your app should be loaded every time.
UIApplicationExitsOnSuspend is the key for your plist to enable/disable background running.
With new iOS 4, multitasking arrived on iPhone and iPod Touch...
For this, when you are debugging or developing an application with the iPhone Simulator, if you press the home button, your app go in background or multitasking. Than Xcode believe that your app is still in use.
For recalling viewDidLoad method, you must completely exit from your app by pressing twice home button then hold down your app in the multitasking bar and tapping on the X.

Developing iPhone app to Run on iPad - Auto Set 2x

Is there a way to programmatically set the iPad to run the iPhone app at 2x as it is launched (yet keep the iPhone app native). I understand I can create NIB files for each hardware platform, but for ease, I just would rather the app launch as if the user had tapped the 2x on the iPad. Thanks...R.J.
No. The pixel-doubling malarkey is not under your app's control, and is pretty much a crutch for apps that weren't designed for the iPad. If you didn't go nuts with specific pixel measurements in the original code, it shouldn't be difficult to move to the larger screen.
It's not quite program control, but you can get an app to start up in 2x mode on iOS 4.2.
I've had a couple of apps that have always started up in 2x mode, and very nice it was too, but I only worked out why this was today!
Steps:
Run iPhone app (e.g., from Xcode)
Use '1x' and '2x' buttons to select desired zoom level
Press home button to get back to launcher
Double tap home button to bring up task manager
Kill your app (hold finger down until icons start to dance, then press the '-' button on your app's icon)
(If you ran under the debugger in step 1, Xcode will tell you the program got a SIGKILL, and might stop somewhere random in the call stack; you can ignore this.)
Now next time you run the program, it will start up with the zoom level you selected in step 2!
I didn't test absolutely every method of closing the program, but this preference doesn't get saved if you stop it from Xcode (e.g., using Run|Stop menu item), and it doesn't get saved if your program terminates using exit. Closing it using the launcher is the only way I've found so far...