0
votes

I'm using a swc from the Axiis project to display visualizations in a project I'm working on. I've run into a bug where re-compiling the library swc would be an easy solution, but I can only use the buggy version of the swc.

I have the Axiis source and compiled a version with the bug fixed, though I'm not allowed to use it because of client version restrictions.

Does anyone know how I can use the updated Actionscript class/file in my code so it overrides the swc class?

1
By "client" restrictions do you mean restrictions in the Flash Player? Or restrictions from the entity paying you to develop? If the latter I'm shocked that recompiling code is wrong, but monkey patching is good. They are just two different ways to use the same code. One is 'proper' and one is hack.JeffryHouser
yeah client by person paying me to do the app, and a review process for a new build by itself would take months. I'm looking for a hack for now until I can get the new library approved.wajiw
hi @Flextras, I work with Wa-jiw, agreed this is a hack but sometimes swcs get approval for us based on being run through testing and we aren't allowed to modify the swc but can use the already tested (even though it has bugs). We had already tried what Christophe suggested but the problem is the code being overrode is in a class that isn't referenced directly from the application (problem is essentially 3/4 compatibility, original swc was written for 3 and now being used in 4, axiis), even making a reference to the modified class and recompiling, the swc classes seem to use the old one. thxshaunhusain

1 Answers

4
votes

I'm not sure if you are allowed to do the following: put the class with your fix in the source path of your main application. If you make sure the package and class names match exactly with the original class, the compiler will pick this class up instead of the one in the library. We do this often when we want to patch the Flex framework without having to compile the libraries ourselves.

Another idea might be to use AS3Commons-Bytecode to create a proxy of the class you want to fix and then have your code work on the proxy instead of the original instance. This is a pure runtime fix. It's a bit more advanced and it will only work if you can somehow get the proxy to replace the original instance of the class you need to fix.