When doing game development for Android or Blackberry Tablet OS with Adobe
AIR, you can load SWF files on the fly at runtime; with AIR for iOS, there is no
such option. On Android or Blackberry Tablet OS the code is interpreted from
ActionScript bytecode, whereas for iOS all code must compiled from ActionScript
bytecode to native bytecode as a single IPA file, which you can only create from
a single SWF.
If your game has dozens of levels and each level is a SWF, then compiling for iOS can be a challenge. When you're in the game programming and testing phase of development, you can use
One solution is to compile each level to a SWC library, and then link all the SWCs into a single SWF file (see Figure 1).
If your game has dozens of levels and each level is a SWF, then compiling for iOS can be a challenge. When you're in the game programming and testing phase of development, you can use
ipa-test-interpreter
switch in the
compiler settings, and your game will run as it would on Android or BlackBerry
Tablet OS. However, Apple will not accept games built using this approach in the
App Store, so you need a different approach for your release build.One solution is to compile each level to a SWC library, and then link all the SWCs into a single SWF file (see Figure 1).
Figure 1.
For iOS, first compile SWCs and then link them together to produce a single SWF
file.
Creating a single SWF from SWCs
If you're using Flash Builder, you'll need to use a Flex Library Project (see
Figure 2), which outputs a SWC file, instead of an ActionScript project, which
outputs a SWF.
Figure 2.
Select Flex Library Project, which creates a SWC file.
In Flash Professional CS5.5, you can use an option in the Publish Settings
dialog box to generate a SWC instead of a SWF (see Figure 3).
Figure 3.
Select SWC under the Publish options in the Publish Settings dialog box.
Where to go from here
When you use the technique outlined in this article for your iOS game
development, you'll need to instantiate new levels at runtime instead of loading
them dynamically. Remember, it is possible to load SWF files on iOS, but the
code inside them won't be interpreted. Loading a SWF in this way is useful for
graphical assets such as animations or vector graphics. You can create a library
full of symbols and simply pick the symbol that you want to use.
Lastly, note that this technique works for ActionScript 3, but not ActionScript 2.
Lastly, note that this technique works for ActionScript 3, but not ActionScript 2.
~ 0 comments: ~
Post a Comment