开发者

How to monkey patch or override a swc class in Flex?

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-开发者_如何学Ccompiling 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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜