Saturday, November 22nd, 2008
Memory Management:
- Read “Memory Management and Optimizations in Flash Lite” at http://www.adobe.com/devnet/devices/articles/memory_management.html
- Watch the memory usage in the Emulator’s Memory window. If you are unfamiliar with memory management and fragmentation, read page 6 in the link above.
- Set no longer needed local vars to null.
- Delete class references when you are done with them.
- Use MovieClipLoader, loadClip, loadMovie and loadMovieNum so that you can use unloadMovie and unloadMovieNum to free memory as much as possible.
- Divide your app into multiple swfs to distribute the load. This is the key to distributing load in a large mobile application.
- Remember that MovieClips exported using Linkage in the Library add additional weight that cannot be removed. If you have a lot of Linkage, distribute into multiple SWFs.
- Keep tweens to a minimum. One at a time, if possible.
- Do not tween alpha or apply any scaling, if possible.
Testing:
- Test on the actual device ASAP.
- When working in the Device Manager’s Emulator choose the actual device from the Emulators Online Library. The Sample Device Set’s tend to have significantly more memory and all features enabled, and therefore do not give you an accurate idea of how your app will perform on the actual device.
- Review the Device Profile for the selected device, particularly to determine what Content Types are available and what FSCOMMAND2 commands are available for each content type.
What to do when:
- If you get a “Internet: Unable to connect to network. Try again later.” message while running your app on the phone, this is likely caused by a load process unable to complete. For example, if you are dynamically loading a series of images into a SWF or a MovieClip, and the destination for those images is removed before they complete their load, you will receive the above error message for each image that was unable to load. To resolve this you will either need to wait for images/data to finish loading, stop the images/data from continuing to load, or both before continuing with your event.
- If something works in the emulator but not on the actual device, test on a different device (a different make and model). This will help determine the scope of the problem.
- If you are dynamically loading images and you find that they display as expected in the emulator, but not on the phone, you may need to embed each image into a swf.
Emulator Bug:
- Not all device content types support full screen. If you have been testing on a device content type that does, and then switch to one that does not, it may still display in full screen mode, despite the fact that it actually does not support full screen. If you continue to choose other content types and then return it will usually return to non-full screen if not supported. Check the Device Profile FSCOMMAND2 list for accurate specs on the phone.
Tips for building your app:
- Create a KeyManager class that you can pass a class reference to, so that the KeyManager can access the interface definitions of that reference. The KeyManager class will handle the onKeyDown events for the soft keys, d-pad, number keys, and any additional keys you may have.
- If you are running a main swf locally and there are other sfws that live on a server and need access to your local swf, you will need to set allow the network swfs access. Add System.security.allowDomain( “http:www.somedomain.com” ); to the local swf.
- You do not need to set the fscommand2 setSoftKeys command when running your app in the emulator, but you do when running it on the actual device if you want control of the soft keys.
- Consider running an event that calls the fscommand2 extendBackLight command to keep your app lit. For example, set an interval that runs every 15 seconds to extend the back light duration.
Tags: AS2, Flash, Flash Lite, Mobile
Posted in ActionScript, Flash, Mobile | No Comments »