Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8471787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T16:53:29+00:00 2026-06-10T16:53:29+00:00

Here’s the scenario: We have a creative team that operates in Flash CS5.5 and

  • 0

Here’s the scenario:

We have a creative team that operates in Flash CS5.5 and produces SWF assets which have both graphics elements and actionscript code in them, and an engineering team which authors .as files and builds “code SWFs”. The code SWF files must load or embed the creative assets and interact with the code therein for our apps to function.

For iOS mobile development, there is another consideration – it is not possible to load runtime code in an AIR app packages for iOS because of Apple TOS (see related question). Hence, it is not possible to use a Loader to load SWFs in an iOS environment and retain their code.

Embedding a SWF into an ActionScript file the standard way results in a Loader that loads the embedded SWF directly as bytes. This results in access to the top-level, main timeline as follows:

[Embed(source="embed_test.swf")]
  private var no_aot_support:Class;

public function main():void
{
  var no_ios:* = new no_aot_support();
  addChild(no_ios);
  no_ios.addEventListener(Event.COMPLETE, function():void {
    var timeline:MovieClip = no_ios.getChildAt(0).getChildAt(0);
    trace(timeline.foo); // foo variable exists, output is 'blah'
  });
}

However, this embedding mechanism doesn’t work on iOS devices because runtime-code is not allowed per Apple’s TOS – all code must be passed through the ahead-of-time compiler (AOTCompiler) at compile-time, and the SWF embedded in this way does not meet this criteria.

Asking around, I found that one can use a class-level embed to get around this, as a class-level embed does go through the compiler and will result in working code under iOS:

package
{
  import flash.display.MovieClip;

  [Embed(source="embed_test.swf", symbol="Symbol1")]
   public final dynamic class anim extends MovieClip { };
}

This works fine, but I don’t want to reference a symbol in the SWF, I want the whole swf (aka reference the main timeline), but the following results in a compiler error:

package
{
  import flash.display.MovieClip;

  [Embed(source="embed_test.swf")]
   public final dynamic class anim extends MovieClip { };
}

I’ve also decompiled the SWF, found the main timeline symbol, and tried this:

package
{
  import flash.display.MovieClip;

  [Embed(source="embed_test.swf", symbol="embed_test_fla.MainTimeline")]
   public final dynamic class anim extends MovieClip { };
}

But the compiler insists this symbol doesn’t exist.

Since I have many, many SWF assets, I need a solution that doesn’t involve changing my whole workflow (i.e. going into each FLA and making changes). This should be possible, and if not, this is a workflow problem Adobe should address.

So here I am stuck – regular embeds get the MainTimeline but don’t work in iOS, class-level embeds work in iOS and can’t access the MainTimeline.

Feel free to download my expample project and play with this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T16:53:31+00:00Added an answer on June 10, 2026 at 4:53 pm

    I’m posting my own workaround to this problem, in case any happens by this question:

    There is a more details response here: Is it possible to embed or load SWFs when making iphone apps (Is it allowed by Apple)

    I’ve created a tool to workaround this issue by merging embedded SWFs into the main SWF. In this way, the embeds are AOT-compiled and converted into objective-c code, so I get an instance of my asset (the main timeline), and the asset’s code is properly cross-compiled to work on iOS devices.

    It works by using an embed like this:

    [Embed(source="GameLevel.swf")]
      private var GameLevel:Class;
    
    public function main():void
    {
      var my_level:* = new GameLevel();
      addChild(my_level);
    }
    

    In this scenario, if gameLevel.swf has code in it, it typically wouldn’t work in iOS, because new gameLevel() would create a Loader and interpret SWF bytecode. But, if you first run the above SWF through my tool called SWFMerge, it will take your embedded SWF and merge it into your root SWF. Then ADT will compile your main swf (including embedded code) into objective-C, it will work on iOS, and note: new gameLevel() now results directly in an instance of your asset – NOT a Loader.

    The SWFMerge tool is here:

    http://www.onetacoshort.com/temp/SWFMerge_alpha.swf

    Let me know in the comments if this workaround works for you or if you have trouble.

    I’ll add that using a SWC workflow is better and officially supported, but this workaround is great in a pinch when you either don’t have the original FLA source file, or simply want to quickly use existing assets with code in them.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's my scenario - I have an SSIS job that depends on another prior
Here is my scenario. I have a website running under AppPool1 and that works
Here is the problem that I am trying to solve. I have two folders
Here is my code (Say we have a single button on the page that
Here is the issue I am having: I have a large query that needs
Here is the scenario: I'm writing an app that will watch for any changes
Here are the tables I have: Table A which has entries with item and
Here's the code I have. It works. The only problem is that the first
Here the scenario is I have many .aspx pages if any page gives error,
Here's the view: @if (stream.StreamSourceId == 1) { <img class=source src=@Url.Content(~/Public/assets/images/own3dlogo.png) alt= /> }

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.