Flex/Actionscript 3: Is it possible to generate a class at runtime that inherits from another class?
I'd like to be able to generate a class that inherits from BitmapData at runtime. Is this possible in Actionscript 3? If so, what i开发者_运维问答s the syntax?
I do not think that you will find yet a mature library to do that. There are two open source projects for dealing with ABC bytecode manipulation but they seems to be in infancy. You can take a look on at http://code.google.com/p/flemit/ and http://code.google.com/p/floxy/
As the author of flemit / floxy (though both were only created for asmock), I would recommend looking into AS3Commons Bytecode as it is under active development (flemit/floxy are not).
AS3Commons Bytecode is actually based on the Loom project and has been extended to use a much cleaner API than flemit was ever intended to have.
I've never seen that, but you could probably mimic that sort of behavior with a static class that you can feed standard BitmapData objects into at runtime...
精彩评论