A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Compiling Multiple SWFs to Single SWF

  1. #1
    Junior Member
    Join Date
    Oct 2010
    Posts
    1

    Compiling Multiple SWFs to Single SWF

    Hello All,

    I'm building out a Flash / Flex viewer and I'm looking for a tool / software that will recompile several to many SWFs into one SWF file. I have an XML file and would like to load that into a compiler that would compile the SWFs into a single file. Please let me know your thoughts and thanks in advance.

    I appreciate your help.

    Rob

  2. #2
    Senior Member joshstrike's Avatar
    Join Date
    Jan 2001
    Location
    Alhama de Granada, España
    Posts
    1,136
    When you say you're loading an XML list into a compiler...the SWFs are already compiled. So are you talking about creating a master swf that just loads them up one by one? Or do you mean you need them to all be embedded as library objects so that the main source code can access them?

    By the time the XML is loaded in, it's too late to compile; whatever you've created is already compiled and is then loading up the XML. There's no way for an SWF to recompile itself on the fly and actually embed other SWFs in the process. But what you can do is load them in from the XML list using URLRequest and Loader.

    On the other hand if you want them to all be included in the SWF on an as-needed basis, like to give your main SWF instant embedded access to their properties, you can put this into your document class in Flex Builder:

    [Embed (source="local/path.swf", mimeType="application/octet-stream")]
    public var embeddedSWF:Class;

    You put that at the very top of your document class (inside the class, not in the package with the includes). This only works in Flex or Flash Builder 4, it's part of the Flex compiler and not actually Actionscript. What it does is it makes the embeddedSWF class in this case be the document class for the SWF you're embedding.

    But just so you're not confused, the way the compiler works is that it only includes classes that you actually use in your code, even if you include other classes in the package headers. And you can't do this dynamically at runtime, because we're talking about actually embedding the SWF from your local hard drive into the new SWF you're creating. At runtime, you would have to use a Loader.
    The Strike Agency
    http://www.theStrikeAgency.com

    StrikeSapphire -- The Original Bitcoin Casino
    https://strikesapphire.com
    (not available in the US)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center