Recover a broken .fla - that infamous "Unknown file format"

I came to develop a flash app again recently and suddenly faced a nightmarish  situation:While saving my fla Flash stated the file couldn't be saved at its current location and terminated. Although the file looked good from its size and icon in the explorer I wasn't able to open it in Flash-"Unknown file format", grrr.
After some googling around and half way to forking out some bucks for a swf decompiler I found some hints to this rather manual and hackish approach to the problem:

I made a copy off the corrupt .fla and renamed it to .zip. on opening the .zip I found some xml files along a folder structure containing my library items as bitmaps and xml files. A hint found on stackoverflow.com stated that you could recover the library whith editing/replacing the DOMDocument.xml. Heres the recipe I worked along:

I made a new blank fla the size and properties of the broken one. Along the lines I restored all library folders in the structure I had them but leaving them empty for the symbols I was about to recover later on.

Then I unzipped the images from the renamed broken fla and imported them to my new one to save on editing time in the DOMDocument.xml.

After the library was restored to all but the symbols of buttons and movieclips, I saved the fla, quit Flash and went for the fun part of hacking the library.

I renamed the new fla to zip, opened the DOMDocument.xml and added my symbols in the <symbols node> along with their relative folder path like so:

<Include href="FoldernameInLibrary/Symbolname.xml" loadImmediate="false"/>

By printing the directory contents of all the folders in the library, this is a simple two-step search-and-replace job.
Soon as my DOMDocument.xml contained all nodes for my library symbols I saved it, closed the zip and renamed it back to fla.

Since all my scripts where done in FlashDevelop as external as files, my fla was 100% restored. phew.


Keine Kommentare:

Kommentar posten

You might as well leave a comment on this matter: