0 Replies Latest reply on Jul 31, 2008 6:27 PM by PaulAtSfly

    Expanding functionality of Classes between SWCs

    PaulAtSfly
      I'm working on developing an AIR version of a Flex application. I have a SWC file that contains common components that I want to use between projects, but I want to extend the functionality of some of the classes and compile it into an SWC based on the original SWC file. For example, KeyboardEvent has basic functionality in Flex, but has additional properties available in AIR, and both the AIR and Flex keyboard events reside at the same package structure (flash.events.KeyboardEvent).

      How does Adobe handle this in its own swc framework? I image there’s some way that when Adobe built sdks/3.0.0/frameworks/airframework.swc they based it on sdks/3.0.0/frameworks/framework.swc somehow. I tried doing the same thing by creating a 2 Library projects, then basing the second library off the first; but, I couldn’t figure out how to make the class com.test.Test in Library 2 extend com.test.Test in Library 1 like I image Adobe did to extend the functionality of KeyboardEvent between Flex and Air.

      Can anyone explain how Adobe does this? I want to keep both Flex and Air projects in the same package and class structure so their usage is as seamless as Adobe’s Flex and Air libraries. I have some ideas using namespaces and compiler constants, but I assume there has to be a more elegant solution that what I’ve come up with.

      Just to illustrate the library structure:
      I have a class in the parent SWC
      ParentLibrary > src > com > test > Test.as

      ChildLibrary includes the ParentLibrary project and wants to extend ParentLibrary > src > com > test > Test.as but keep the same package structure
      ChildLibrary > src > com > test > Test.as

      Adobe does this between its AIR and Flex libraries. How can I do it?