Adobe
Products

Top destinations

  • Adobe Creative Cloud
  • Creative Suite 6
  • Adobe Marketing Cloud
  • Acrobat
  • Photoshop
  • SiteCatalyst
  • Students
  • Elements family

Adobe Creative Cloud

  • What is Adobe Creative Cloud?
  • Design
  • Web
  • Photography
  • Video
  • Students
  • Teams
  • Enterprise
  • Educational institutions
  • Government

Design and photography

  • Photoshop
  • Illustrator
  • InDesign
  • Adobe Muse
  • Lightroom

Video

  • Adobe Premiere
  • After Effects

Web development and HTML5

  • Edge Tools & Services [opens in a new window]
  • Dreamweaver
  • Gaming [opens in a new window]

Adobe Marketing Cloud

  • What is Adobe Marketing Cloud?
  • Digital analytics
  • Social marketing
  • Web experience management
  • Testing and targeting
  • Media optimization

Analytics

  • SiteCatalyst
  • Adobe Discover
  • Insight

Social

  • Adobe Social

Experience Manager

  • CQ
  • Scene7

Target

  • Test&Target
  • Recommendations
  • Search&Promote

Media Optimizer

  • AdLens
  • AudienceManager
  • AudienceResearch

Document services

  • Acrobat
  • EchoSign [opens in a new window]
  • FormsCentral [opens in a new window]
  • SendNow [opens in a new window]
  • Acrobat.com [opens in a new window]

Publishing

  • Digital Publishing Suite

  • See all products
Business solutions

By business need

  • Digital analytics
  • Digital publishing
  • Document management
  • Media optimization
  • Social marketing
  • Testing and targeting
  • Video editing and serving
  • Web development [opens in a new window]
  • Web experience management
  • See all business needs

By industry

  • Broadcast
  • Education
  • Financial services
  • Government
  • Publishing
  • Retail
  • See all industries
Support & Learning

I need help

  • Products
  • Adobe Creative Cloud
  • Adobe Marketing Cloud
  • Forums [opens in a new window]

I want to learn

  • Training and tutorials
  • Certification [opens in a new window]
  • Adobe Developer Connection
  • Adobe Design Center
  • Adobe TV [opens in a new window]
  • Adobe Marketing Center
  • Adobe Labs [opens in a new window]
Download
  • Product trials
  • Adobe Flash Player
  • Adobe Reader
  • Adobe AIR
  • See all downloads
Company
  • Careers at Adobe
  • Investor Relations
  • Newsroom
  • Privacy
  • Corporate Social Responsibility
  • Customer Showcase
  • Contact us
  • More company info
Buy
  • For personal and professional use
  • For students, educators, and staff
  • For small and medium businesses
  • Volume Licensing
  • Special offers
  • Adobe Marketing Cloud sales [opens in a new window]
Search
 
Info Sign in
Why sign in? Sign in to manage your account and access trial downloads, product extensions, community areas, and more.
Welcome,
My Adobe
My orders
My information
My preferences
My products and services
Sign out
My cart
Privacy My Adobe
Adobe
Products Sections Buy   Search  
Solutions Company
Help Learning
Sign in Sign out Privacy 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
Promotions
Estimated shipping
Tax
Calculated at checkout
Total
Review and Checkout
Adobe Developer Connection / Gaming /

Joining multiple SWF files into one SWF for iOS deployment

by Tom Krcha

Tom Krcha
  • Adobe
  • gamingnotes.com

Content

  • Steps for combining multiple SWF files into one
  • Where to go from here

Created

14 March 2012

Page tools

Share on Facebook
Share on Twitter
Share on LinkedIn
Bookmark
Print
Adobe AIRFlash BuilderFlash Professional CCgame developmentgamingiOSmobileSWF
Was this helpful?
Yes   No

By clicking Submit, you accept the Adobe Terms of Use.

 
Thanks for your feedback.

Requirements

Prerequisite knowledge

This article is intended for advanced developers with knowledge of Flash Builder or Flash Professional. You'll also need to know how to work with the command line on Mac OS X or Windows.


Additional required other products

  • REBOL/View

User level

Advanced

Required products

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

Sample files

  • rswf-join-example.zip

One of the issues you run into in game development on the Flash platform is how to combine the numerous SWFs that make up your game into a single SWF for iOS deployment. As an example, Machinarium, a point-and-click puzzle game developed by Amanita Design, has 28 SWF files. When Amanita Design used Adobe AIR to produce the iPad version of Machinarium, they needed a way to join the multiple SWF files into one (see Figure 1).

Figure 1. Combining multiple SWF files into one to prepare for creating a single IPA file.
Figure 1. Combining multiple SWF files into one to prepare for creating a single IPA file.

In my article Using SWC files to build large Flash and AIR projects with multiple SWF files for iOS, I covered a technique that relies on SWC libraries to address this issue. In some cases, however, you may prefer to keep using SWFs instead of SWC files. If your game will run on Android as well as iOS, for example, your workflow may be more straightforward with SWFs. Remember that on Android, you can load SWF files at runtime, which enables efficient memory usage. On iOS you also have to keep memory usage in mind, especially when you have all your code in one SWF. It is a good practice to separate any assets that do not contain ActionScript (including pictures, videos, and music) into SWF files, which your game can load on demand and then discard when no longer needed.

After you've separated out your assets, you still need a way to join the SWFs that do contain ActionScript. In this article, I describe the technique used by David "Oldes" Oliva, lead developer of Machinarium, for joining SWFs together using a REBOL script. For more information on REBOL, visit http://www.rebol.com.

Steps for combining multiple SWF files into one

Follow these steps to join SWF files in preparation for deploying your game on iOS:

  1. The first step is to build the SWFs in Flash Professional or Flash Builder as you would normally, but make each SWF a class. Instead of loading a SWF dynamically via the Loader class, SWFLoader, or a similar mechanism, you'll instantiate the SWF class. Once you join all SWFs together, you will be instantiating its contents, not loading it.
  2. Download and unzip the sample files for this article.
  3. Download and install REBOL/View, the graphical version of REBOL.
  4. Navigate to the samples folder and locate the three scripts that you might want to update to customize for your workflow: compile-and-run.r, Game.bat, and Game.rswf.
  5. If you're interested, you can explore the compile-and-run.r file in a text editor. This is a REBOL script that does some initial set up and runs Game.bat.
  6. Open Game.bat in a text editor and edit the path to your AIR SDK so that it points to your installed version of AIR Debug Launcher (ADL). The file contains the following lines:
cd ./public/ adl Game.xml

Change them as follows:

cd ./public/ [/path/to/your/AIR_SDK]/bin/adl Game.xml
  1. Open Game.rswf in a text editor and update the import-swf lines to reflect the SWFs you want to combine. The initial example joins four SWF files:
import-swf %assets/Preloader.swf no show import-swf %assets/ExampleLevel1.swf no show import-swf %assets/ExampleLevel2.swf no show import-swf %assets/ExampleMain.swf no show
  1. Run the REBOL script. (Change the path to the rebol command below to where you installed it.)
/path/to/REBOL/rebol compile-and-run.r

Note: If you see a permission denied error when you try to run any of the executable files, make sure the files have the proper permission settings. You can set the permissions using chmod , for example (substitute 755 or 775 for a more restrictive setting):

chmod 777 filename.bat
  1. When the script completes, the SWF will open in Flash Player and you can use the adt tool included in the AIR SDK to compile the final IPA file for iOS. For example, you can run the following at the command line, replacing the bracketed sections as appropriate:
[AIRSDK]/bin/adt -package -target ipa-app-store -provisioning-profile [YOURPROFILE].mobileprovision -storetype pkcs12 -keystore [YOURCERTIFICATE].p12 -storepass [CERTIFICATE_PASSWORD] [FINALAPP].ipa air-app-descriptor.xml [SWFTOCOMPILE].swf

Where to go from here

If you think the SWC approach may better meet your needs, see my article Using SWC files to build large Flash and AIR projects with multiple SWF files for iOS. To learn more about REBOL, see the REBOL Quick Start. If you are interested in the main rules for Rebol/Flash Dialect (RSWF), Oldes has documented them here. Lastly, if you want to see what a small, independent game development studio can do with the Flash Platform, visit Amanita Design.

Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License+Adobe Commercial Rights

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. Permissions beyond the scope of this license, pertaining to the examples of code included within this work are available at Adobe.

More Like This

  • Flash glossary: Projector
  • Flash glossary: Flash Player
  • Flash glossary: Device font
  • Flash glossary: Runtime shared library
  • Flash glossary: Output panel
  • Flash glossary: Preloader
  • Flash glossary: Window Mode
  • Multitouch and gesture support on the Flash Platform
  • Flash glossary: SWF
  • Flash glossary: Object tag parameter

Products

  • Adobe Creative Cloud
  • Creative Suite 6
  • Adobe Marketing Cloud
  • Acrobat
  • Photoshop
  • Digital Publishing Suite
  • Elements family
  • SiteCatalyst
  • For education

Download

  • Product trials
  • Adobe Reader
  • Adobe Flash Player
  • Adobe AIR

Support & Learning

  • Product help
  • Forums

Buy

  • For personal and professional use
  • For students, educators, and staff
  • For small and medium businesses
  • Volume Licensing
  • Special offers

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 © 2013 Adobe Systems Incorporated. All rights reserved.

Terms of Use | Privacy (Updated) | Cookies

Ad Choices