Adobe Air android with 2 swfs questions

On some devices my game takes awhile to load so I used this workaround, in order to put a splash screen while loading. Everything was working fine, until I used an ANE for AdMob ads. The moment the ANE initializes the splash screen goes on top and covers the entire screen. So I am going to try “plan B” which is to use two swfs. One with the game itself and the other as a preloader.

My questions:

a) That approach is going to be very expensive performance wise?
b) I am storing some settings data from user in a shared object. Some data I think must be initialized at the very begging of the app, like the stage quality. Those 2 swfs can have access at the same shared object?

and finally c) Can you suggest a better plan than plan B?

Thank you for you time!

I’m not sure I understand the problem

when you say

is that a bad thing?
is it not what the splash screen supposed to do? cover the whole screen?

Before using the ANE the splash screen was showing only until the app loads. When I use the ANE, the splash screen re-appears the moment I initialize it, and covers everything, making the game unplayable. The game is continuing to run normally behind the splash screen. I can even hear that the controls are working and that the game is fully responsive.

Oh ok so that make more sense as a bug

2 SWF could work but imho you could streamline all that with just 1 SWF

Using the -frame option for the compiler

And to have a splash screen and/or preloader
You could use a mixin class like what ppl were doing with the Flex framework

I don’t have the details now as I’m on the move but I posted something similar on the Adobe forum like 1 week ago with example etc

Searching this forum archive you’ll find info on the -frame option

Thank you for your answer…

Well… (embarrassment here) I am new to as3 and programming in general, I just (almost) finished my very first game (which you can find here by the way as beta). So I do not know how to compile with command line. I compile with animate cc… I do not though put code in timeline, I use .as files. If you could point me to a tutorial how to do it I’ll definitely try it!

it’s OK, there is a start for everything, before programming ActionScript/Flash you did not know them either right?

in general the command-line is not mandatory, but for certain case
the only way to do it will be on the command-line as there are no GUI options available

so for the -frame option you can find more information here

Even if you compile with Animate CC, underneath it uses a command-line compiler
see ActionScript compilers

now the problem is that Animate CC, even if very convenient, does not give access to the full set of options to those compilers.

If you look at it, it’s not hard, instead of going through different config panel in Animate CC, instead you edit XML files, and run the tools on the command-line.

So the best advice I could give is learn the command-line, learn the options of the compiler, learn how to configure, how to set up different SDK, use either the AIR SDK (ASC2) or the Flex SDK merged with the AIR SDK (ASC1), etc.

Also, if you look at other programming languages, other ecosystems etc.
anything that can build software is based on command-line tools,
if today you feel “you don’t need it”, tomorrow to be able to reuse some OSS projects,
or other tools coming from other world like JavaScript, Java, Python, etc.
you will not be able to avoid that damn command-line.

To use something like -frame “as is” from Animate CC you can’t.

To go without the command-line and so without -frame you could then do a preloader
following this

Using Metadata Frame for a Preloader, based on that Preloaders in AS3

using something like


will tell the compiler that you want to use a “simple” class first to manage the loading of the whole SWF, and so it will display first that simple class while the bytes of the SWF are loading, and once all is loaded then it initialise the “main” class of your application.

Ideally you would use it with the compiler option -frame to really control what is loaded and in which order, for ex: load fonts on frame 1, load assets on frame 2, load ANE1 on frame 3, etc.

now, I never used that from Animate CC and without configuring the compiler, so it might or might not work in your specific case.

Thank you very much! Your answers are very good and detailed as usual!

I will definitely learn the command line and I’ll try to compile my project in such way. But just in case I fail to do so, I would like to know your opinion about my concerns of using 2 swfs.

a) That approach is going to be very expensive performance wise?
here you said that

2 SWF could work

So I am guessing it will be ok performance wise.

About b:
b) I am storing some settings data from user in a shared object. Some data I think must be initialized at the very begging of the app, like the stage quality. Those 2 swfs can have access at the same shared object?
I would like to know that, if it’s posible. I researched of course before asking here, but did not manage to find any useful info about it…

Finally I’d like to add, that my experience with adobe air and flash so far is very positive. The workflow was very smooth and intuitive. Also managing to compile my first “Hello World” without any “hassles” (eg of a command line), and being easy to compile as easy as pressing a single buttton 9-10 months ago, gave me the boost and the enthusiasm to start learning as3! Since that day I finally reached my first milestone. Today I am very happy that my first project, while far from perfect cause of my inexperience, is on line at play store. This “feat” is very important to me, and gives me the necessary boost and the enthusiasm to start my next project.

I will make sure that at my second project, I will start compiling with command line from the very first day. I believe it will be easier to grasp the command line with a fresh project, in case I fail to do so with my current project…

Once again thank you very much! A big part of my success is credited to your invaluable and detailed help here!

That is really the beauty of Flash or Animate CC is that you don’t have to be a pro-engineer to start projects, you can see visual things right from the start and is very inclusive of anyone wanting to build things.

Now, I’m pro command-line because I know all the benefits it can bring, but let be clear it is not essential, in fact at the beginning if the command-line were to discourage someone to pursue a project I would discourage it.

It is more important to get started than being stopped right form the bat because the barrier to entry is too high, which sadly is exactly what is happening to web development in general and in particular with JavaScript.

It should be an evolution, start simple with small’ish projects, and go bigger, or more complex, and more stuff, and more this or that, etc. and then go with the command-line with this logic of wanting to do more, but only if it really serve that purpose.

anyway about using 2 SWF, it should work nicely, especially with an Android app
but in the long run it may not be the right solution

if for example you want to also publish on iOS, there using 2 SWF instead of 1 would make things a bit more harder and complex.

So let cover the basics

  • a SWF is just a stream of bytes
  • a SWF can “embed” many things wether it is images, sounds, videos, code, etc.
  • a SWF can as well embed another SWF or dynamically load other SWF
  • one specific case can be problematic when loading a SWF
    is when you want this loaded SWF to completely replace the current SWF
  • another problematic case is with iOS, there even if technically you seem to load a SWF,
    because of the way how the code is compiled the SWF end up being embedded anyway

so when you say using 2 SWF, it will “hurt” with those 2 “problematic” cases

Loading a SWF that replace the original SWF, eg. you load a SWF into the main Stage

  • you may replace (or overwrite) already loaded assets and not being able to reference them
  • it may also replace some code state
  • and at the opposite it can prevent you to load the same code
    SWF loading class MyApp, then loading SWF2 containing a new definition of the class MyApp
    the runtime (Flash or AIR) will complain that the definition of MyApp alredy exists and can not be replaced

Now, if you have a main SWF that load a child SWF as an external asset, without replacing the main SWF, but just being an addition to it, yeah there you should have no major issues.

Still, I would say “if you can, try to use only 1 SWF”, and only load external static assets like image, sound, etc.

yes, in the situation where you load another SWF, as long as it doesn’t completely replace the main SWF, you will be able to access any definitions of code like a SharedObject

but that’s also where you could see the complexity of it
SWF1 has the SharedObject instance defined
SWF2 does not know that

so you can either pass the reference of that SharedObject instance from SWF1 to SWF2
so SWF1 has to tell SWF2 “here use that”

or you can load again the SharedObject in SWF2 but then you have 2 instances of the same data in that SharedObject and then you can end up with synchronisation issues

eg. before using the SO always reload it first
and after using the SO always flush it to save the data

it will work but imho it add complexity compared to do that with only 1 SWF

so before you asked

yes maybe, if you can do it in such a way where you can control on which frame the code is used, if I remember well in Flash/Animate something like

publish settings … then actionscript options at the top
“Export classes in frame” and set it to 3 for ex

then in the Library add a new Symbol type MovieClip
and under Advanced set it to “Export ActionScript” and “Export in frame 1”

the class should be found in your source path
and keep the base class as flash.display.MovieClip
but technically it could be also flash.display.Sprite

and so with that, you can apply the logic of the preloader
without necessarily using the metadata (if for example not supported without modifying compiler options)

the class exported in frame 1 is your preloader
you basically test the loaderInfo.bytesLoaded / loaderInfo.bytesTotal of the whole SWF

when it hit frame 3 it will then load all the other actionscript classes (eg your main app logic)

and when you reach bytesLoaded == bytesTotal simply add your main class to the stage

that way your preloader class can show an image or even a simple animation for a splash screen, and only when everything is completely loaded you can switch, remove from stage the preloader and add the main class.

Thank you very much for the detail answer. I am trying the various option that we gather here, in order to find what suits me best…

The 2 swfs solution: Unfortunately did not work. While with tracing I can see the loading progress advancing while debugging, in real devices nothing shows until the app is 100% loaded.

The preloader class solution did not worked either. But it is very possible that I am missing something, or something I am doing wrong… I checked the option to export class at frame 3, except the preloader class. Then I could not figure out how to export preloader class at frame 1, only frame 3 was available for “ticking”.

So, at this point I tried some ideas that I had.

a) I put the preloader as movieclip on stage at frame 1 in Animate cc by drag and drop. With some tweaking to correct some errors, I managed to make it work, but only locally while debugging. In a real device again blackscreen until the whole app loads. I only see for a tiny moment the 100%.

b) I removed the preloader class, and I put the preloader code (with appropriate alterations) straight in the 1st frame of timeline. I never put code in timeline before, except some stop(); occasionally. I felt very desperate… Again it worked, but only locally while debugging, same as (a)…

c) After many hours of trial and errors, I had an “Eureka” moment! I removed the as document class and I put the as document class. Again like every single time before, it works only locally, not in real device…

So now I am almost convinced, that the only way to do it is by the command line ONLY.

I already looked at the official link that you gave me, but I do not know how to begin…
The more I read, the more I get confused…

Do I have to download flex sdk?
how flex sdk is related to air?
Do I build first, and then I package apk with another command line?
… and many many more questions…

I find it very difficult and confusing… I need to learn all that with examples. Can you please point me to any tutorial?

ok so let’s go step by step

what OS are you using ? Windows? macOS? other?

first you need to setup a sane environment for your command-line,
especially under Windows

so just ell me your OS and I ll gives you few directions and options to follow
please indicate if your OS is 32bit or 64bit

from that point we will pick a command-line to work with
then install Java, and after that install Flex SDK/AIR SDK etc.

for the rest

the gist is that
with Animate CC, it “embed” the FLEX SDK and the AIR SDK but use a kind of wrapper around them to talk to them

to do the same without Animate CC here few things to know

Flex SDK provides the compilers for SWF and SWC etc.
ASC is the core ActionScript Compiler (but most people do not use it)
MXMLC will compile SWF files
COMPC will compile SWC files
ASDOC will compile HTML documentation based on the sources (yeah it wokrs like a compiler)

AIR SDK provide other kind of tools
ADL - AIR Debug Launcher
ADT - AIR Developer Tool

ADL allow you to test locally your AIR app
ADT allow you to package your AIR app into APK, IPA, etc.

both ADL and ADT need a SWF file and an app XML file

now you can have 2 kind of setup because there are 2 kind of AIR SDK

  • a Flex SDK merged with an AIR SDK
    it uses ASC1 underneath
  • just an AIR SDK
    it uses ASC2 underneath
    and custom versions of MXMLC, COMPC and ASDOC

in both case the command-line tools for AIR will have an “a” preprended to the command-line
mxmlc will become amxmlc
compc will become acompc
asdoc will become aasdoc

the difference are

  • instead of using playerglobal.swc (The Flash Player API) as dependency
    they will use airglobal.swc (The Adobe AIR API)
  • the compiler config will be different
  • and few other things

see ActionScript compilers

see also Creating your first desktop AIR application with the Flex SDK

For now, just know that
when you go to download the AIR SDK here

the blue pills make you download the AIR SDK (ASC2)
either AIRSDK_Compiler.dmg (older may use .tbz2) for macOS or for Windows
this one embed custom Flex SDK compilers and so you don’t need to also download a Flex SDK

the links at the very bottom (in the grey area) make you download the AIR SDK (ASC1)
either AdobeAIRSDK.dmg for macOS or for Windows
this one HAVE TO be merged with a Flex SDK, it will not work as standalone

You can also download AIR SDK from Archived Adobe AIR downloads

Now, there are also 2 types of Flex SDK

that’s because around November 12, 2011 Adobe donated the Flex SDK project to the Apache foundation, read the details here Your Questions About Flex

Let’s say for now you don’t really need to bother about which Flex SDK you use as you don’t really build that is dependent on Flex (the framework) but only the compilers.

so you can simply download and keep it around
it will install on Windows or macOS from the same zip file

Choosing between installing AIR SDK (ASC2) without Flex SDK
or installing AIR SDK (ASC1) with a Flex SDK

and how to organise all that on your file system

for example (that’s my way to do it, other different way could work too)

at the root of your drive you could have a directory named “sdk” then subdirectories named “air” and other named “flex” etc.


  |_ sdk
      |_ air
      |_ flex

macOS (and Linux too)

  |_ sdk
      |_ air
      |_ flex

and you install the AIR SDK (ASC2) under C:\sdk\air or /sdk/air
and you install the Flex SDK under C:\sdk\flex or /sdk/flex

you could end up with such structure

/ or C:\> (the "root" of your SDK)
  |_ sdk
      |_ air
      |   |_ 31_0
      |   |_ 32_0
      |   |_ 32_0_0_89
      |   |_ 32_0_0_109_BETA
      |_ flex
          |_ 4_5_1
          |_ 4_5_1_AIR_2_6
          |_ 4_6_0
          |_ 4_6_AIR_31_0
          |_ 4_6_AIR_32_0
          |_ 4_6_AIR_32_0_0_89
          |_ 4_6_AIR_32_0_0_109_BETA
          |_ 4_14_1
          |_ 4_14_1_AIR_31_0

so why would you want to do that?

  • first, you want to be in control of which SDK you use
  • you may start working on app with AIR 31
    and the next month start another app with AIR 32
    but still compile the first app with AIR 31 while you compile the new app with AIR 32
  • you may want to use BETA AIR SDK for testing new features you may want to implement later
  • even if you work alone now, maybe your app will become a success and you might work with another dev or designer etc. simply other people that may be on other operating systems
  • you may want to use a much older AIR SDK to target a specific platform
    for ex: you can publish an AIR desktop app for Linux only with AIR 2.6
  • you want to be able to mix different workflow
    • someone just need to publish a SWF to work on the UI (do not need the AIR API)
    • someone need to compile under Windows
    • someone need to compile under macOS
    • someone need to compile the documentation
    • someone just need to sign (without compiling) to publish the final package
    • you need to compile the very same app but downgrading its features and compile for Linux, or compile for Mac PPC, or use a specific AIR version that officially support Windows XP, etc.
    • etc.

but it is exactly reproducible builds that you really want

eg. “I built it exactly with this version, exactly with those assets, exactly with those icons/images/ANE/etc.”
“if you reuse the same build, or rebuild it, you will get the exact same result”

wether you use AIR SDK (ASC2)
some things might work differently between a 32_0 (or 32_0_0_89) version considered “finale”
and a 32_0_0_109_BETA version (the latest beta)

same if you use Flex SDK, you might have case where you just need to produce a SWF or a SWC to produce a library where you don’t need the AIR SDK options

so you could use the 4_6_0 version and target “Flash Player 9”

in other case where you want to use the Flex SDK merged with the AIR SDK
you may decide to merge the Flex SDK 4.6.0 with AIR 32 finale release
and so use 4_6_AIR_32_0 (or 4_6_AIR_32_0_0_89)

or you might want to test with a beta and use 4_6_AIR_32_0_0_109_BETA

and maybe for other reasons you might want to use another Flex SDK, for ex 4_14_1
and again merged it with another AIR SDK 4_14_1_AIR_31_0

So yeah it does seems “more complicated” but really it is just about controlling versions of the runtime, so when you face a bug or any other kind of problem you know exactly what’s going on.

I leave that there, but first is to know the command-line you use under your OS,
then organise the SDK, then when you ave that in place you setup a build, simply put a “text” file where you indicate which versions to use and allow you to build thing in very specific orders.


Wow! So much information! I just red it… once and I will study it more carefully tomorrow.

For now I will say two things:

a) I have windows 10 64bit and I will organize the folders as you said.
b) I will credit you in my app, and in every future app, in the “thank you” section!


I created c:\sdk and put inside the AIR32 sdk, so now is c:\sdk\AIR32

I also put c:\sdk\AIR32\bin into PATH system variables.

So now I am guessing:

Do I remove the as document class and then I compile the swf in animate cc? That will have as result an empty stage, but behind the scenes will be all the assets and the code, except the
Then I suppose, I use the command line and somehow I include the and the

Am I at the right track? Or I’ll use the fla file directly into command line? In that case you should know that I include some swc files.

Thank you for your time!

yeah and please take it as a soft guideline, nothing prevent you to change the organisations of stuff later on as you see fit, but let’s just say it will make things easier for a start

so Windows 10, good, 64bit, even better

in general it is good to not use a too old OS for the build of your app
and something sometimes “not obvious” is that most tools in general
but in particular the Adobe SDK etc. support only to build from a 64bit OS

that’s because if you need to build both 32bit and 64bit, you can only do that from a 64bit OS

so for that, if Windows is your OS of choice I would advise either a
Windows 8.1 Pro 64-bit (at the minimum) or Windows 10 Pro 64-bit (ideally)

so first thing to do is to install Java, simply because all the SDK tools depends on Java
you could get away with a Java JRE (only install runtimes) but I would advise to install a JDK (install runtimes and Java SDK)

Go there

and select a recent JDK for Windows 64-bit
but it does not really have to be the bleeding latest version
as the Adobe SDK tools need minimum JDK 1.6

in the current choices you have

anyone would work but technically you could use Java SE 8u20x

so in term of versioning: Java SE v8" means “JDK v1.8” (few years ago they changed the way how they version Java)

in fact, if you have doubt about such things (what version of something to install) check out the wikipedia page, so here
or here

it should make clearer what is what

For the command-line itself, Windows kind of always had a “bad command-line”
and so by default you will have access to the Windows command prompt

but there is also another one: the Windows PowerShell
(easy to differentiates the two because PowerShell use a blue background by default)

they are all command shells

simply put a text interface to your computer: you write commands (the standard input) and it output results as text in general (the standard output), and sometimes with some errors the output is considered an error stream (the standard error).

every command shells use its own language, sometimes it can be very similar but it depends

here under Windows, every valid command for CMD.exe is also valid for the PowerShell
for ex: ver

C:\> ver

Microsoft Windows [Version 6.3.9600]


this part C:\> is called the command prompt

with PowerShell you will see a “PS” PS C:\>

with other operating system you might see something with a $ for a normal user
or a # for a root user (a kind of super user or administrator)

The very basic to know, please don’t let that discourage you

  • a command shell allow you to input commands that you usually write by hand
    those commands can be either internal to the shell or can be external commands
    that in fact depends on a command-line executable
    • the command echo is internal to the CMD shell (eg. it does not depend on an external echo.exe)
    • the command java (to execute Java) will depends on an external executable named java.exe
  • a command shell find those external executables based on an environment variable usually named PATH
    • do read about environment variable
    • do read about PATH
    • under Windows to know what is inside this variable just type C:\> echo %PATH%
      you will see a list of paths separated by a ;
    • for now the only thing you need to check is to be sure to have the path to the Java executables in your PATH, after you install a Java SDK (you might need to reboot or restart the command shell)
    • so instead of typing C:\> C:\ProgramData\Oracle\Java\javapath\java.exe (the full path)
      you will just have to type C:\> java.exe
    • read about some commands here
      and here
  • a command shell, in general, allow to be scripted and under Windows you can write Batch scripts with the extension .bat
    • those scripts allow you to use a basic programming language
      so you can write a series of commands into a file, maybe use a couple of variables, and run it as if it was a real executable (but that I mean a binary)
    • so yes at the beginning using the command-line will be slower if you type everything by hand
  • but once you get you can write little scripts to repeat and automate this and that it becomes blazing fast eg. C:\> compile_stuff.bat "my_project"

I know it is a lot of stuff but it is a learning process. got step by step, get used to it, explore the different options available to you (I will go more in details with that) and jsut do the basic like “navigating the file system”, “learning the basic commands of the current shell”, “write little scripts”, etc.

so under Windows 10, here all the options available to you

  • just use the CMD.exe and write .bat scripts
    it is kind of limited but it will be compatible with almost any Windows
    from Windows XP to Windows 10

  • use the PowerShell and learn its own scripting language also named PowerShell
    this is much more advanced and maybe too big to chew when you get started
    see the PowerShell Documentation

  • use a UNIX-like shell under Windows and write scripts in Bash (to not confuse with Batch)
    or also write scripts in almost any other programming languages that can work on the command-line: Perl, Python, PHP, Ruby, etc.

    under Windows it requires a special setup but then it gives you the big advantages to share those scripts (running under Bash) with other OS like macOS and Linux (but technically you can also run PowerShell scripts under macOS and Linux)

    • you can use a Virtual Machine (let’s avoid that for now)
    • you can use Windows Subsystem for Linux or WSL
      in short it install a distribution of Linux like Ubuntu inside your Windows 10
      and give you access to a bash.exe or a wsl.exe that put you into a Bash command shell that is running under Linux but that can still access your Windows file system
      see Windows Subsystem for Linux Documentation
    • you can use Cygwin
      even a default basic install for Windows 64-bit will give you a new commmand shell: MinTTY

      so instead of starting the command prompt (CMD.exe) you start MinTTY and this one directly put you into a Bash shell by running bash.exe and your prompt change to C:\> to $ because now your shell behave like a UNIX-like shell
    • and few more options but let’s stop here for now

Here the logic behind all that, different command shells give you different “super power”, some are easier to automate and program with scripts than others, or could be simply that you will find more examples or scripts to get inspired from, or tutorials etc.

As a beginner into the command-line world I perfectly understand that all those options can be confusing and you start to wonder “wow …is it really worth it to learn all that crap?”

So let review our core goals here

  • to be able to do more advanced stuff you do need it to run on the command-line
    it is how it is, 99% of programming language and tools and SDK go through the command-line
  • wether it is X or Y shell, stick to one shell at the beginning and stick to one scripting language
  • the only goal of knowing those (shell and scripts) is so you can write little program that automate tasks for you but without spending weeks doing so
  • those “little programs” will allow you to perfectly control what is build or not and in which orders
    so yeah you might spend a couple of days writing such script but then by reusing it every day you work on your program you avoid going through a GUI and you save a lot of time (on top of gaining control of what’s going on)
  • the end goal is to have an automated build that not only you can use for this project
    but that you can configure and adapt for other projects in parallel or later

Here classically I guide you towards building such “automated build” using something called Ant

The Flex and AIR SDK being developed in Java they are already setup to use Ant (which also use Java) in some ways, to make it work you just need Java to be installed, some SDK to be installed and write a build.xml file to build your project

to “run the build”, whatever choice of command shell you make you will either need to do something like

C:\> ant.exe


C:\> ant.exe -f build.xml

(I oversimplify but that’s the idea)


$ ant


$ ant -f build.xml


Here an example of build on one of my “old” projects

this build is driven by some configuration files with the .properties extension
for ex

another ex is

this part

FLEX_HOME_MAC = /sdk/flex/4_6
FLEX_HOME_WIN = c:/sdk/flex/4_6

local.flashplayerversion = 11
local.swfversion = 13

is how you get in control of which SDK is used for the compilation
which flash player version is used etc.

the cherry on the cake is that it will work under Windows and macOS, and it could also work the same under Linux

If you work with someone else, you can just give him or her access to your sources
tell which dependencies they need on their system
(you need Java this version, Flex SDK this version, etc.)

and they can run the build on their machine and obtain the same results you get on yours

And yes, “as is” it may seem overkill, especially if you are alone working on your project,
but in the long run, even for 1 dev, such build helps tremendously, not only to be able to do advanced things but for cases where you work on different projects, publish for different targets etc.

that time you spend learning those thing make you a 1 dev army :slight_smile:

Ultimately by knowing how the tools work at this level of detail you gain confidence and you become less afraid to do more :stuck_out_tongue:

If today you’re building only 1 app for only 1 platform Android
tomorrow you will be able to manage many more just by yourself

but step by step, you don’t need to know everything in one day, give yourself the time to explore and learn what is best for you

1 Like

yes that’s one way to do it, and for you now it is perfectly valid

all the executables under the c:\sdk\AIR32\bin folder
are now available to you directly by their name instead of their full path

for ex

C:\> mxmlc --help advanced

side note, later you might want to do slightly differently if you are in the case where you want ot use in parallel c:\sdk\AIR32\bin, c:\sdk\AIR33\bin, c:\sdk\AIR34\bin etc.

that depends

usually if all your code is only .as files
if before you were compiling your app from within Animate CC
then after you can compile your code by using the SDK compilers on the command-line

if your .fla contains assets or symbols you are reusing in your code
you need to “split” the compilation

for example you could

  • compile from the .fla file a component .swc
    for ex: myassets.swc
  • then with the command-line build tell the compiler
    that your source code is depending on that external SWC
  • form within your .as sources you can then reference that
    external asset by its exported symbol name

in the FLA, in your Library
export Symbol foobar as mypath.assets.Foobar
with a base class of MovieClip or Sprite

that generates myassets.swc

in your class for ex

import mypath.assets.Foobar;


var mc1:MovieClip = new Foobar() as MovieClip;

and you compile it this way

C:\> amxmlc -library-path lib-swc/myassets.swc src/

you just tell the compiler that you re using a SWC as a library to reuse in your code
amxmlc will generate a SWC file and then you can launch it with adl

C:\> adl myapp-app.xml

with the file myapp-app.xml referring to myapp.swf (the SWF you just build with amxmlc before)

Now two things

  • you can build it “by hand” writing all the commands on the command-line
    but soon it will get old, so what you want is to use a script or a build tool
    so you can repeat those commands without entering everything yourself
  • using assets compiled from a FLA is mainly useful if your assets are Library Symbols
    you “build by hand” like some timeline animation etc.
    if you just need to reuse “static” assets like sound, images, etc.
    most of those can be embedded directly with your source code

for ex:

 |_ src
       |_ myapp
             |_ ui
                 |_ icons
                      |_ air.png
package myapp.ui.icons
    import flash.display.Bitmap;
    public class air extends Bitmap
        public function air()

and then you use it

import myapp.ui.icons.*;

var air_bmp:Bitmap = new air() as Bitmap;
something.addChild( air_bmp );

this way, using the metadata [Embed(source="something.ext")]
you can embed .png, .jpg, .svg, .mp3, etc.


yes, just do it step by step
maybe use a basic project “displaying a blue rectangle” to test stuff around

and when you get to the point “ah ok you reuse SWC like this” etc.
then you apply that to your current project

I would say from there, look into Java and Apache Ant (mentioned in another post here)

here few links to follow

start simple, take the time to learn Ant, find examples on Github etc.

or try to build existing project from sources, for ex

could be anything else

1 Like

Thank you very much!!!

I see you put a lot of effort to help me, so I’ll try my best to make as good use of your effort as possible!

Now it is time to study! Thank you once again!!!

I updated the special thanks section. I credited this community and personally @zwetan, as I promised.

Now I going back to study the command line. If I succeed, the next update will be with preloader.

1 Like

wow … that super nice, thank you :blush:

you don’t have to mention me by name, just pointing to as3lang is more than enough

let me know if you need different logo formats

some were published here

but I need to updates them with new stuff

just sayin’ … if you need a nicer logo in vector format and with transparency just let me know

1 Like

Thank you for the AS3 logo links. I will use a vector one at next update. Also If you want to remove your name or change it to just Zwetan, tell me, otherwise I will leave it as it is now.

About my studies of the command line:

I started as simple as possible. Learning unix like or PS command line feels overwhelming. So I am trying to understand the basics with the simpler cdm

So far I managed a succesfull build with the following steps:

a) first I compiled my project inside Animate CC to build an swc file that includes my whole project, except the

This is the command line I managed to figure out so far…

amxmlc scr/ -library-path swc/xromatopaixnidia.swc -external-library-path+=[ANE1 here] -external-library-path+=[ANE2 here etc] -frame=0, Preloader -frame=1,Main -swf-version=43

I get some warnings from greensock library, I suppose it’s ok, and I get a Preloader.swf

b) I rename my Preloader.swf to xromatopaixnidia.swf to match my xromatopaixnidia-app.xml file. I know that xromatopaixnidia-app.xml is working fine because I compile my project in Animate CC with it.

c̶)̶ ̶T̶h̶i̶s̶ ̶i̶s̶ ̶t̶h̶e̶ ̶s̶t̶e̶p̶ ̶t̶h̶a̶t̶ ̶I̶ ̶a̶m̶ ̶s̶t̶u̶c̶k̶.̶ ̶ ̶I̶ ̶m̶a̶n̶a̶g̶e̶d̶ ̶t̶o̶ ̶f̶i̶g̶u̶r̶e̶ ̶o̶u̶t̶ ̶t̶h̶e̶ ̶f̶o̶l̶l̶o̶w̶i̶n̶g̶ ̶c̶o̶m̶m̶a̶n̶d̶ ̶l̶i̶n̶e̶.̶.̶.̶ ̶>̶a̶d̶t̶ ̶-̶p̶a̶c̶k̶a̶g̶e̶ ̶-̶t̶a̶r̶g̶e̶t̶ ̶a̶p̶k̶ ̶-̶s̶t̶o̶r̶e̶t̶y̶p̶e̶ ̶p̶k̶c̶s̶1̶2̶ ̶-̶k̶e̶y̶s̶t̶o̶r̶e̶ ̶p̶i̶c̶o̶u̶p̶i̶c̶o̶u̶-̶c̶o̶l̶o̶r̶g̶a̶m̶e̶-̶s̶s̶l̶.̶p̶1̶2̶ ̶ ̶x̶r̶o̶m̶a̶t̶o̶p̶a̶i̶x̶n̶i̶d̶i̶a̶-̶a̶p̶p̶.̶x̶m̶l̶ ̶x̶r̶o̶m̶a̶t̶o̶p̶a̶i̶x̶n̶i̶d̶i̶a̶.̶s̶w̶f̶ ̶ ̶T̶h̶a̶t̶ ̶l̶i̶n̶e̶ ̶p̶r̶o̶m̶p̶t̶ ̶m̶e̶ ̶t̶o̶ ̶t̶y̶p̶e̶ ̶t̶h̶e̶ ̶k̶e̶y̶s̶t̶o̶r̶e̶ ̶p̶a̶s̶s̶w̶o̶r̶d̶ ̶a̶n̶d̶ ̶t̶h̶e̶n̶ ̶I̶ ̶g̶e̶t̶ ̶t̶h̶e̶ ̶f̶o̶l̶l̶o̶w̶i̶n̶g̶ ̶e̶r̶r̶o̶r̶:̶ ̶ ̶>̶ ̶F̶i̶l̶e̶ ̶x̶r̶o̶m̶a̶t̶o̶p̶a̶i̶x̶n̶i̶d̶i̶a̶-̶a̶p̶p̶.̶x̶m̶l̶ ̶i̶s̶ ̶n̶o̶t̶ ̶a̶ ̶v̶a̶l̶i̶d̶ ̶A̶I̶R̶I̶ ̶o̶r̶ ̶A̶I̶R̶ ̶f̶i̶l̶e̶ ̶ ̶ ̶*̶*̶H̶o̶w̶ ̶c̶a̶n̶ ̶I̶ ̶b̶u̶i̶l̶d̶ ̶a̶ ̶v̶a̶l̶i̶d̶ ̶A̶I̶R̶I̶ ̶o̶r̶ ̶A̶I̶R̶ ̶f̶i̶l̶e̶?̶*̶*̶ ̶ ̶I̶f̶ ̶y̶o̶u̶ ̶h̶e̶l̶p̶ ̶m̶e̶ ̶f̶i̶g̶u̶r̶e̶ ̶o̶u̶t̶ ̶t̶h̶a̶t̶,̶ ̶I̶ ̶s̶u̶p̶p̶o̶s̶e̶ ̶m̶y̶ ̶n̶e̶x̶t̶ ̶s̶t̶e̶p̶ ̶i̶s̶ ̶t̶o̶ ̶f̶i̶g̶u̶r̶e̶ ̶o̶u̶t̶ ̶h̶o̶w̶ ̶t̶o̶ ̶p̶u̶t̶ ̶t̶h̶e̶ ̶A̶N̶E̶s̶ ̶i̶n̶t̶o̶ ̶a̶d̶t̶ ̶c̶o̶m̶m̶a̶n̶d̶ ̶l̶i̶n̶e̶.̶ ̶

c) I figured out how to create an airi file and to include ANEs in it. Command line:

adt -prepare airi xromatopaixnidia-app.xml . -extdir …/libs-ane

d) Finally, package time!

adt -package -target apk-captive-runtime -storetype pkcs12 -keystore picoupicou-colorgame-ssl.p12 xromatopaixnidia.airi xromatopaixnidia-app.xml xromatopaixnidia.swf -extdir …/libs-ane

I had errors about missing the icons. I removed the icons reference from -app.xml file. I will figure it out later.
I got xromatopaixnidia.airi with almost double size

e) I renamed the xromatopaixnidia.airi to xromatopaixnidia.apk
I installed the apk into a real device and got wrong screen dimensions. I fixed that easily with [SWF(backgroundColor="#000000", width=“480”, height=“800”, frameRate=“30”)] above Main class…

…and at last I finaly managed to compile and pack into apk BUT…

Now the app is very slooooow with terrible frame rate. Also the loading times did not seem to improve and I did not see any splash screen :frowning:

I suppose I barely have half the job done… So I will try again tomorrow…

Please tell me if you see what I did wrong…

-fix perfomance
-fix preloader
-figure out how to include the icons
-figure out how to set the output name of swf correctly so I will not rename it manually

Thank you for your time!

OK so like that I think you’re doing OK but doing a bit too much together

so let’s fix little things this and there

first, good structure of the files and folders

try to have something like that

    |_ bin-release
    |_ bin-debug
    |_ build
    |   |_ ...
    |_ lib
    |   |_ ...
    |_ src
        |_ ...

projectname is what we call the “root” of the project
and so when you work from the command-line try to work from that folder

other directories

  • src is your source folder, where you put your .as files etc.
  • lib is your libraries folder, where you put .swc files
  • build is where you put files for your build
    (the things that build your project but are not part of your project)
  • bin-debug is where you build the “debug” project
    if you generate a debug .swf it will be generated there
    for ex: if you work with Flash Builder it will put the files there
  • bin-release is where you build the “release” (usually non-debug) of your project
    that’s where you will generate .swf files, .air files, etc.

because you use ANE you might want to distinguish your lib folders
lib-ane for the .ane files
lib for the .swc files

or another case if you had at the same external sources, SWC and ANE
lib-ane for the .ane files
lib-swc for the .swc files
lib for the .as source files (considered external to your project)

for example, if the project name is “xromatopaixnidia”
you could be in a directory structure
C:\work\xromatopaixnidia> for the project


  |_ work
      |_ xromatopaixnidia
      |_ project2
      |_ project3
      |_ etc.

and so you should working from the root of that folder

C:\work\xromatopaixnidia> COMMANDS

that’s what we call the “execution context” or your “pivot point” related to the command-line
when you are IN that directory you know where to access what with relative paths to that “root”

second, use Ant

in the root directory of your project you create few files
for ex:

    |_ bin-release
    |_ bin-debug
    |_ build
    |_ lib
    |_ src
    |_ build.xml

here we are interested in build.xml, that’s your Ant build

the goal is to always run the short command

C:\work\xromatopaixnidia> ant.exe

from the same root directory

and so “Ant” will by default look for build.xml

and inside the build file “build.xml”
you will be able to refer to other build files from the build/ folder
refer to the sources of the project from src/

to get there you need to install Apache Ant

download it from
under " Current Release of Ant"
you will get either a .zip file or a .tar.gz file or a .tar.bz2 file

to install manually, take the .zip file, unzip it into your program files
get it’s full path, and then add an environment variable to be able to access it later

for ex, with a Java JDK " Java SE 8u202"
should be installed there C:\Program Files\Java\jdk1.8.0_202\

and with an Apache Ant ""
should be unzipped/installed there C:\Program Files\Java\apache-ant-1.9.14\

in your environment variables
you define

JAVA_HOME with the value C:\Program Files\Java\jdk1.8.0_202\
ANT_HOME with the value C:\Program Files\Java\apache-ant-1.9.14\

and the you modify the PATH so it contains the value

eg. you had to your PATH: %JAVA_HOME%\bin and %ANT_HOME%\bin

see Add to the PATH on Windows 10

once all that is setup, from your root folder run ant

C:\work\xromatopaixnidia> ant.exe

output should be

Buildfile: build.xml does not exist!
Build failed

so create the file “build.xml” and try again

C:\work\xromatopaixnidia> ant.exe

output should be

Buildfile: C:\work\xromatopaixnidia\build.xml

C:\work\xromatopaixnidia\build.xml:1: Premature end of file.

Total time: 0 seconds

and that’s normal, now write a very basic build

<?xml version="1.0" encoding="UTF-8"?>
<project name="xromatopaixnidia" default="main" basedir=".">
    <target name="main">
        <echo message="hello world" />
        <echo>project name = ${}</echo>

output should be

Buildfile: C:\work\xromatopaixnidia\build.xml

     [echo] hello world
     [echo] project name = xromatopaixnidia

Total time: 0 seconds

now with that basic stuff go read the Ant manual and learn the basic

if Ant or Java is not setup correctly, the manual will have infos about that

do absolutely read “Using Apache Ant” and follow the
Writing a Simple Buildfile tutorial

from that point, write your build.xml

  • detect if the folder bin-release exists, if not create it

  • in a “compile task” translate your command-line

    amxmlc scr/ -library-path swc/xromatopaixnidia.swc -external-library-path+=[ANE1 here] -external-library-path+=[ANE2 here etc] -frame=0, Preloader -frame=1,Main -swf-version=43

    to use the task Exec see List of Tasks

    • learn to define variables
      for ex: <property name="swf_version" value="43"/>
    • learn to use variables, for ex replace things like scr/ with ${src}/
      or do something like -swf-version=${swf_version}
    • learn to define variables into an external .properties file
      and load that file into your ant build

also for the performance and preloader stuff
set that aside for now, just learn to compile your project from the Main class without the preloader
we will add that later


ok good but don’t burn that step

in general you will find lots of tutorial to learn the UNIX-like command-line
but less the Windows command-line

here few links

Computer Hope How to use the Windows command line (DOS)

Bleeping Computer Introduction to the Windows Command Prompt

Princeton University Windows Command Prompt in 15 Minutes

Microsoft Docs Windows Commands
gives you a list of all console commands built in and their documentation

for ex for ver

1 Like