Reacting to iPhone Status Changes Events By| Flash CS5| ActionScript 3.0| Beginner Developing applications on the or any new mobile device require additional consideration to be made because the application may be interrupted by many different ways as someone might make a phone call to the user which will force the user to switch away from the application. Alternative situations that could happen including switching off the application directly or having the device go into sleep mode, each of these events will have to be managed and reacted to accordingly if you want your application to be properly usable. Jan 15, 2013 private function fl_Activate(event:Event=null). That doesn't mean that you'll use those abilities right away, but when you do use the features from AS3. The key code value of the key pressed to trigger a keyFocusChange event. RelatedObject: InteractiveObject. A reference to the complementary InteractiveObject instance that is affected by the change in focus. ShiftKey: Boolean. Indicates whether the Shift key modifier is activated, in which case the. For this chapter of AS3 101, we will be diving into the mechanics of the Flash event system. If you've been following along so far, you'll have seen events in use. ActionScript 3 event handling tutorial. Consult in Adope ActionScript 3.0 Language and Components Reference. Event property; activate. ActionScript 3.0 API defines several Event subclasses for common events that require additional information. A blog entry by Matt Przybylski on creating custom events: AS3: Custom Events. View the examples. [static] The ACTIVATE constant defines the value of the type property of an activate event object. Luckily, ActionScript 3.0 makes it very easy to track these events and reach to them by using a number of NativeApplication Events. In order to be able to follow this tutorial you will have to be familiar with the basic concepts of. Why React to Status Changes? Imagine that you are playing a game on your iPhone and someone calls you, the game will have to be interrupted in order for you to receive that phone call, if you do not arrange for your application to pause the action and show the pause menu you made the game will continue to run in the background even though the sound is muted. Of course, that will suck for the player because he would probably have lost the game by the time the call is finished. The same thing happens when the user presses on the sleep button, your game will not freeze on its own as the iPhone OS cannot determine the internal mechanisms by which your application is paused. In certain situations you will also want to make sure that you force the game to save when the user presses the home button. For all these reasons you have to react to status changes on the iPhone to make your game usable. How to React to Status Changes? Reacting to status changes on the iPhone is pretty easy as all you have to do is register for the corresponding event using the NativeApplication class. This class can be used directly in any iPhone or AIR application to react to application level events. The events have to register an event listener by the nativeApplicationa property of the class which corresponds to the actual application this way.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
March 2018
Categories |