1 Reply Latest reply on Aug 18, 2009 8:06 AM by Ir0nClad

    Flex 3 vs Flex 4 Preprocessor directives and code behind (External Actionscript file)

    Ir0nClad Level 1

      I have a framework that I've built that I want to use on Flex3 and Flex4.

       

       

      I've added pre-processor directives as per this link (http://livedocs.adobe.com/flex/3/html/help.html?content=compilers_21.html) and got my Flex 4 code to compile nicely.

       

      I then went to flex 3 and discovered my sub-class of Application wouldn't compile because it was based off of spark. No problem, I'll add in a directive.

       

      Except now my overridden class has duplicate code, specific to which SDK it is using.

       

      No problem, I'll put all of the application class code in an Actionscript file and include it in both Application class declarations for each directive.

       

      It works nicely in Flex 3, so I went to Flex 4, tried to compile and now I'm getting compiler errors saying things such as "The (private|public|protected) attribute may only be used on class property definitions." and "The (private|public|protected) attribute can only be used inside a package.

       

      This same file works in Flex 3, but not in Flex 4.

       

      What can I do to make the code compile in both places?

       

      I'll work on a simple case so I can upload some code.