marlar
marlar

Reputation: 4135

Decompiling, modifying and compiling a flash object

I have never worked with flash (SWF) before but I am in a situation where I need to modify an old flash object used internally on a site. The problem is that the flash object contains a year picker that stops with 2021 which is a problem now.

The source code is not available anymore (it's nearly 10 years old) but I have managed to decompile it using an online service and thus obtaining the source. I also found the year picker's definition, which goes like this:

        ...
        {
            label:"2020",
            data:"2020"
        }, {
            label:"2021",
            data:"2021"
        }];

So the actual change is easy enough, but how do I proceed from here?

I have no idea how to compile flash, and there is no make file etc which I guess is normally used.

How do I compile the flash object again from the modified source?

Note: For various reasons it is not an option to simply skip the flash object and building the same functionality using HTML.

Upvotes: 2

Views: 3115

Answers (1)

marlar
marlar

Reputation: 4135

Based on the suggestions from Organis, this is what I did.

  1. I downloaded the Free Flash Decompiler and opened the SWF file. This gave me a treeview of objects and code modules to the left.
  2. I searched for "2021" since this was the last year in the dropdown.
  3. Found the relevant section which looked like this:

     ...
     {
       "label":"2020",
       "data":"2020"
     },{
       "label":"2021",
       "data":"2021"
     }];
    
  4. I tried editing the source code, but it didn't work. Got a namespace error.

  5. Instead I edited the P Code in the right pane. It looked like this:

    pushstring "label"
    pushstring "2022"
    pushstring "data"
    pushstring "2022"
    newobject 2
    ...
    newarray <number of years>
    
  6. Note that array length had to be adjusted to the total numbers of years in the range

  7. Furthermore I had to increase the stack size etc because the Flash object crashed when loaded. I increased all these values a little by trial-and-error.

    body
    maxstack 17
    localcount 3
    initscopedepth 15
    maxscopedepth 17
    

Hope it helps somebody in a similar situation.

Upvotes: 3

Related Questions