Loading ...
Sorry, an error occurred while loading the content.

Conditional importing of classes

Expand Messages
  • dorkie dork from dorktown
    Is there a way to conditionally import a certain class? For example, I have a MXML component that when some options are set it should import classes X, Y and
    Message 1 of 8 , Dec 1, 2010
    • 0 Attachment
      Is there a way to conditionally import a certain class? For example, I
      have a MXML component that when some options are set it should import
      classes X, Y and Z. With other options set it should import classes A,
      B and C. Is there anyway to have the compiler only include the classes
      I need?

      JP
    • Gregor Kiddie
      What are you aiming to achieve with this? There s almost certainly a better way than conditional imports... Gk. From: flexcoders@yahoogroups.com
      Message 2 of 8 , Dec 1, 2010
      • 0 Attachment

        What are you aiming to achieve with this?

         

        There’s almost certainly a better way than conditional imports…

         

        Gk.

         

        From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of dorkie dork from dorktown
        Sent: 01 December 2010 08:16
        To: flexcoders@yahoogroups.com
        Subject: [flexcoders] Conditional importing of classes

         

         

        Is there a way to conditionally import a certain class? For example, I
        have a MXML component that when some options are set it should import
        classes X, Y and Z. With other options set it should import classes A,
        B and C. Is there anyway to have the compiler only include the classes
        I need?

        JP

      • Robert VanCuren Jr
        I am when you says certain options are set I am assuming you mean at runtime? If so it is to late because imports happen at compile time. Any thing you import
        Message 3 of 8 , Dec 1, 2010
        • 0 Attachment
          I am when you says certain options are set I am assuming you mean at runtime? If so it is to late because imports happen at compile time. Any thing you import and then actually use in your code will get built into your swf. There are ways to do conditional compilation but most of the time they are more head ache than good so unless this is really what you need you should stay away.

          If you are worried about the size of your swf or want to be able to load code at runtime consider using Modules or Runtime Shared Libraries. Both of those provide some good flexibility while allowing you to keep your swf files small.

          If you could provide more details on what you are trying to achieve maybe we could better help you.



          On Wed, Dec 1, 2010 at 5:48 AM, Gregor Kiddie <gregor.kiddie@...> wrote:
           

          What are you aiming to achieve with this?

           

          There’s almost certainly a better way than conditional imports…

           

          Gk.

           

          From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of dorkie dork from dorktown
          Sent: 01 December 2010 08:16
          To: flexcoders@yahoogroups.com
          Subject: [flexcoders] Conditional importing of classes

           

           

          Is there a way to conditionally import a certain class? For example, I
          have a MXML component that when some options are set it should import
          classes X, Y and Z. With other options set it should import classes A,
          B and C. Is there anyway to have the compiler only include the classes
          I need?

          JP


        • dorkie dork from dorktown
          I have a utility framework that I m using to test and debug at run time. It will only grow in size. When I create a release build I don t want to have to
          Message 4 of 8 , Dec 3, 2010
          • 0 Attachment
            I have a utility framework that I'm using to test and debug at run time. It will only grow in size. When I create a release build I don't want to have to comment out the utility each time (it's an MXML tag). So I'd like to exclude this class or the classes it imports for release build but include them when debugging.

            On Wed, Dec 1, 2010 at 8:07 AM, Robert VanCuren Jr <robert.vancuren.jr@...> wrote:
             

            I am when you says certain options are set I am assuming you mean at runtime? If so it is to late because imports happen at compile time. Any thing you import and then actually use in your code will get built into your swf. There are ways to do conditional compilation but most of the time they are more head ache than good so unless this is really what you need you should stay away.

            If you are worried about the size of your swf or want to be able to load code at runtime consider using Modules or Runtime Shared Libraries. Both of those provide some good flexibility while allowing you to keep your swf files small.

            If you could provide more details on what you are trying to achieve maybe we could better help you.





            On Wed, Dec 1, 2010 at 5:48 AM, Gregor Kiddie <gregor.kiddie@...> wrote:
             

            What are you aiming to achieve with this?

             

            There’s almost certainly a better way than conditional imports…

             

            Gk.

             

            From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of dorkie dork from dorktown
            Sent: 01 December 2010 08:16
            To: flexcoders@yahoogroups.com
            Subject: [flexcoders] Conditional importing of classes

             

             

            Is there a way to conditionally import a certain class? For example, I
            have a MXML component that when some options are set it should import
            classes X, Y and Z. With other options set it should import classes A,
            B and C. Is there anyway to have the compiler only include the classes
            I need?

            JP



          • Richard Rodseth
            In one of my apps I did this for mock classes: CONFIG::emulated { import com.companyname.foo } import com.companyname.bar Then there is a compiler flag
            Message 5 of 8 , Dec 6, 2010
            • 0 Attachment
              In one of my apps I did this for mock classes:

                          CONFIG::emulated {
                          import com.companyname.foo
                          }
                          import com.companyname.bar

              Then there is a compiler flag

              -define=CONFIG::emulated,true

              I don't believe you can have conditional compilation in MXML, but you can have it in script blocks.

              Hope this helps.

              On Fri, Dec 3, 2010 at 3:38 PM, dorkie dork from dorktown <dorkiedorkfromdorktown@...> wrote:
               

              I have a utility framework that I'm using to test and debug at run time. It will only grow in size. When I create a release build I don't want to have to comment out the utility each time (it's an MXML tag). So I'd like to exclude this class or the classes it imports for release build but include them when debugging.


              On Wed, Dec 1, 2010 at 8:07 AM, Robert VanCuren Jr <robert.vancuren.jr@...> wrote:
               

              I am when you says certain options are set I am assuming you mean at runtime? If so it is to late because imports happen at compile time. Any thing you import and then actually use in your code will get built into your swf. There are ways to do conditional compilation but most of the time they are more head ache than good so unless this is really what you need you should stay away.

              If you are worried about the size of your swf or want to be able to load code at runtime consider using Modules or Runtime Shared Libraries. Both of those provide some good flexibility while allowing you to keep your swf files small.

              If you could provide more details on what you are trying to achieve maybe we could better help you.





              On Wed, Dec 1, 2010 at 5:48 AM, Gregor Kiddie <gregor.kiddie@...> wrote:
               

              What are you aiming to achieve with this?

               

              There’s almost certainly a better way than conditional imports…

               

              Gk.

               

              From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of dorkie dork from dorktown
              Sent: 01 December 2010 08:16
              To: flexcoders@yahoogroups.com
              Subject: [flexcoders] Conditional importing of classes

               

               

              Is there a way to conditionally import a certain class? For example, I
              have a MXML component that when some options are set it should import
              classes X, Y and Z. With other options set it should import classes A,
              B and C. Is there anyway to have the compiler only include the classes
              I need?

              JP




            • Gregor Kiddie
              Following the preload swf method would be better wouldn t it? Such as http://jpauclair.net/2010/02/17/one-swf-to-rule-them-all-the-almighty-pr eloadswf/
              Message 6 of 8 , Dec 6, 2010
              • 0 Attachment

                Following the preload swf method would be better wouldn’t it?

                 

                Such as http://jpauclair.net/2010/02/17/one-swf-to-rule-them-all-the-almighty-preloadswf/

              • dorkie dork from dorktown
                I think this will work. Thank you ... I think this will work. Thank you On Mon, Dec 6, 2010 at 11:33 AM, Richard Rodseth wrote:   In
                Message 7 of 8 , Dec 8, 2010
                • 0 Attachment
                  I think this will work. Thank you

                  On Mon, Dec 6, 2010 at 11:33 AM, Richard Rodseth <rrodseth@...> wrote:
                   

                  In one of my apps I did this for mock classes:

                              CONFIG::emulated {
                              import com.companyname.foo
                              }
                              import com.companyname.bar

                  Then there is a compiler flag

                  -define=CONFIG::emulated,true

                  I don't believe you can have conditional compilation in MXML, but you can have it in script blocks.

                  Hope this helps.



                  On Fri, Dec 3, 2010 at 3:38 PM, dorkie dork from dorktown <dorkiedorkfromdorktown@...> wrote:
                   

                  I have a utility framework that I'm using to test and debug at run time. It will only grow in size. When I create a release build I don't want to have to comment out the utility each time (it's an MXML tag). So I'd like to exclude this class or the classes it imports for release build but include them when debugging.


                  On Wed, Dec 1, 2010 at 8:07 AM, Robert VanCuren Jr <robert.vancuren.jr@...> wrote:
                   

                  I am when you says certain options are set I am assuming you mean at runtime? If so it is to late because imports happen at compile time. Any thing you import and then actually use in your code will get built into your swf. There are ways to do conditional compilation but most of the time they are more head ache than good so unless this is really what you need you should stay away.

                  If you are worried about the size of your swf or want to be able to load code at runtime consider using Modules or Runtime Shared Libraries. Both of those provide some good flexibility while allowing you to keep your swf files small.

                  If you could provide more details on what you are trying to achieve maybe we could better help you.





                  On Wed, Dec 1, 2010 at 5:48 AM, Gregor Kiddie <gregor.kiddie@...> wrote:
                   

                  What are you aiming to achieve with this?

                   

                  There’s almost certainly a better way than conditional imports…

                   

                  Gk.

                   

                  From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of dorkie dork from dorktown
                  Sent: 01 December 2010 08:16
                  To: flexcoders@yahoogroups.com
                  Subject: [flexcoders] Conditional importing of classes

                   

                   

                  Is there a way to conditionally import a certain class? For example, I
                  have a MXML component that when some options are set it should import
                  classes X, Y and Z. With other options set it should import classes A,
                  B and C. Is there anyway to have the compiler only include the classes
                  I need?

                  JP





                • dorkie dork from dorktown
                  Bingo! On Mon, Dec 6, 2010 at 12:01 PM, Gregor Kiddie wrote:
                  Message 8 of 8 , Dec 8, 2010
                  • 0 Attachment
                    Bingo!

                    On Mon, Dec 6, 2010 at 12:01 PM, Gregor Kiddie <gregor.kiddie@...> wrote:
                     

                    Following the preload swf method would be better wouldn’t it?

                     

                    Such as http://jpauclair.net/2010/02/17/one-swf-to-rule-them-all-the-almighty-preloadswf/


                  Your message has been successfully submitted and would be delivered to recipients shortly.