Search code examples
flash

How to extract images from a SWF file?


I have a Flash object in a SWF file. It contains an image that I need to extract, so I can use it directly for devices not supporting Flash.

How can I extract the image from the SWF? What tools should I use?


Solution

  • Well it depends on the situation, at any case you'll need a way to identify that image inside the file aka a symbol.

    Case 1. Embed

    [Embed(source="assets/library.swf", symbol="AImage")]
    [Bindable]
    public var AImage:Class;
    

    Case 2. Runtime

    (this code is executed once the loader has loaded your swf source file)

    loader.contentLoaderInfo.applicationDomain.getDefinition("AImage");
    

    Hope it helps