Adobe
Products
Acrobat
Creative Cloud
Creative Suite
Digital Marketing Suite
Digital Publishing Suite
Elements
Photoshop
Touch Apps
Student and Teacher Editions
More products
Solutions
Digital marketing
Digital media
Education
Financial services
Government
Web Experience Management
More solutions
Learning Help Downloads Company
Buy
Home use for personal and home office
Education for students, educators, and staff
Business for small and medium businesses
Licensing programs for businesses, schools, and government
Special offers
Search
 
Info Sign in
Welcome,
My cart
My orders My Adobe
My Adobe
My orders
My information
My preferences
My products and services
Sign out
Why sign in? Sign in to manage your account and access trial downloads, product extensions, community areas, and more.
Adobe
Products Sections Buy   Search  
Solutions Company
Help Learning
Sign in Sign out My orders My Adobe
Preorder Estimated Availability Date. Your credit card will not be charged until the product is shipped. Estimated availability date is subject to change. Preorder Estimated Availability Date. Your credit card will not be charged until the product is ready to download. Estimated availability date is subject to change.
Qty:
Purchase requires verification of academic eligibility
Subtotal
Review and Checkout
Adobe Developer Connection / Flash Developer Center /

Using SWC files to build large Flash and AIR projects with multiple SWF files for iOS

by Tom Krcha

Tom Krcha
  • Adobe
  • flashrealtime.com

Content

  • Creating a single SWF from SWCs
  • Where to go from here

Created

27 February 2012

Page tools

Share on Facebook
Share on Twitter
Share on LinkedIn
Bookmark
Print
Adobe AIR Android deployment Flash Builder Flash Professional gaming iOS SWF

Requirements

Prerequisite knowledge

This article is intended for advanced developers with knowledge of Flash Builder or Flash Professional.

User level

Advanced

Required products

  • Flex Builder (Download trial)
  • Flash Professional (Download trial)

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 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.
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.
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.
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.0, but not ActionScript 2.0.

For information on combining several SWFs into a single SWF, see my article Joining multiple SWF files into one SWF for iOS deployment.

 

Creative Commons License
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License

More Like This

  • Creating a simple document in Flash CS4 Professional
  • Learning Flash CS4 Professional
  • Blitting and caching movie clips in Flash
  • Guide for Apple App Store submissions
  • Using screen orientation APIs for smartphone application development
  • Optimizing content for Apple iOS devices
  • Optimizing performance for mobile AIR applications
  • Multitouch and gesture support on the Flash Platform
  • Saving state in AIR applications for iOS devices
  • Creating a simple mobile game using the Code Snippets panel in Flash

Flash User Forum

More
04/23/2012 Auto-Save and Auto-Recovery
04/23/2012 Open hyperlinks in new window/tab/pop-up ?
04/21/2012 PNG transparencies glitched
04/01/2010 Workaround for JSFL shape selection bug?

Flash Cookbooks

More
02/13/2012 Randomize an array
02/11/2012 How to create a Facebook fan page with Flash
02/08/2012 Digital Clock
01/18/2012 Recording webcam video & audio in a flv file on local drive

Products

  • Acrobat
  • Creative Cloud
  • Creative Suite
  • Digital Marketing Suite
  • Digital Publishing Suite
  • Elements
  • Mobile Apps
  • Photoshop
  • Touch Apps
  • Student and Teacher Editions

Solutions

  • Digital marketing
  • Digital media
  • Web Experience Management

Industries

  • Education
  • Financial services
  • Government

Help

  • Product help centers
  • Orders and returns
  • Downloading and installing
  • My Adobe

Learning

  • Adobe Developer Connection
  • Adobe TV
  • Training and certification
  • Forums
  • Design Center

Ways to buy

  • For personal and home office
  • For students, educators, and staff
  • For small and medium businesses
  • For businesses, schools, and government
  • Special offers

Downloads

  • Adobe Reader
  • Adobe Flash Player
  • Adobe AIR
  • Adobe Shockwave Player

Company

  • News room
  • Partner programs
  • Corporate social responsibility
  • Career opportunities
  • Investor Relations
  • Events
  • Legal
  • Security
  • Contact Adobe
Choose your region United States (Change)
Choose your region Close

North America

Europe, Middle East and Africa

Asia Pacific

  • Canada - English
  • Canada - Français
  • Latinoamérica
  • México
  • United States

South America

  • Brasil
  • Africa - English
  • Österreich - Deutsch
  • Belgium - English
  • Belgique - Français
  • België - Nederlands
  • България
  • Hrvatska
  • Česká republika
  • Danmark
  • Eastern Europe - English
  • Eesti
  • Suomi
  • France
  • Deutschland
  • Magyarország
  • Ireland
  • Israel - English
  • ישראל - עברית
  • Italia
  • Latvija
  • Lietuva
  • Luxembourg - Deutsch
  • Luxembourg - English
  • Luxembourg - Français
  • الشرق الأوسط وشمال أفريقيا - اللغة العربية
  • Middle East and North Africa - English
  • Moyen-Orient et Afrique du Nord - Français
  • Nederland
  • Norge
  • Polska
  • Portugal
  • România
  • Россия
  • Srbija
  • Slovensko
  • Slovenija
  • España
  • Sverige
  • Schweiz - Deutsch
  • Suisse - Français
  • Svizzera - Italiano
  • Türkiye
  • Україна
  • United Kingdom
  • Australia
  • 中国
  • 中國香港特別行政區
  • Hong Kong S.A.R. of China
  • India - English
  • 日本
  • 한국
  • New Zealand
  • 台灣

Southeast Asia

  • Includes Indonesia, Malaysia, Philippines, Singapore, Thailand, and Vietnam - English

Copyright © 2012 Adobe Systems Incorporated. All rights reserved.

Terms of Use | Privacy Policy and Cookies (Updated)

Ad Choices

Reviewed by TRUSTe: site privacy statement