11 Replies Latest reply on Jul 15, 2008 1:54 PM by jfizer

    Explicite call to top level classes?

    jfizer
      I've been trying to find a solution to this with no luck so far, so let me try to rephrase the issue.

      I'm writting a Flex application for use with SalesForce.com. Sales Force has a set of tools for Flex that allow me access to their database objects. However, it also contains classes called "Error" and "AsyncResponder". This of course conflicts with the Adobe classes of the same name. AsycnResponder I can get around by using a full call to the class including the containing objects. However, "Error" is a top level class. So how do I explicitly call it using the "mx.container.class" style of naming reference?
        • 1. Re: Explicite call to top level classes?
          ntsiii Level 3
          It should be in a different package and shouldn't conflict.

          Perhaps use the full package path to call it? Post a snippet of the code that is causing a problem.

          Tracy
          • 2. Re: Explicite call to top level classes?
            jfizer Level 1
            quote:

            Originally posted by: ntsiii
            It should be in a different package and shouldn't conflict.

            Perhaps use the full package path to call it? Post a snippet of the code that is causing a problem.

            Tracy

            Thats what I want to do, use the full package path to call Error. However its a top level object and has no package.
            • 3. Re: Explicite call to top level classes?
              ntsiii Level 3
              Post a snippet of the code that is causing a problem.
              Tracy
              • 4. Re: Explicite call to top level classes?
                jfizer Level 1
                quote:

                Originally posted by: ntsiii
                Post a snippet of the code that is causing a problem.
                Tracy

                There's not much to post. Any call to the Error class returns, well an error. This is because I have two classes, both called Error. I need to do a direct call to the Adobe Error class to get around this. But Error is a top level class with no container as far as I can tell.
                • 5. Re: Explicite call to top level classes?
                  Zal
                  I would suggest to just repackage the classes from SalesForce.com, no?
                  • 6. Re: Explicite call to top level classes?
                    jfizer Level 1
                    quote:

                    Originally posted by: Zal
                    I would suggest to just repackage the classes from SalesForce.com, no?



                    Not an option I fear, no source code. I know it's the fault of the Sales Force package, but there's nothing I can do about it other then code around the problems it creates.

                    But there MUST be a way to access a top level object directly...
                    • 7. Explicite call to top level classes?
                      jfizer Level 1
                      This is far for a solution, but I found a work around so long as I don't actually need to use the error data but just pop-up a more user friendly message. Using Object rather then Error lets everything run without any "errors" so to speak. But I still maintain that there must be a way to directly call a top level class.
                      • 8. Re: Explicite call to top level classes?
                        VarioPegged Level 2
                        How are you using the error data? Will extending Error.as (Adobe's) work for you?

                        TS
                        • 9. Re: Explicite call to top level classes?
                          jfizer Level 1
                          quote:

                          Originally posted by: VarioPegged
                          How are you using the error data? Will extending Error.as (Adobe's) work for you?

                          TS

                          I doubt it since I would (I think) get the same error message about "Can not resolve a multiname reference unambiguously" when I tried to extend the Error class. Unless I compiled a SWC before hand in another probject.... I guess that could work. Seems silly however.
                          • 10. Re: Explicite call to top level classes?
                            VarioPegged Level 2
                            What happens when you try my suggestion? I might be misunderstanding how you're doing this, but if you import the SF.com Error.as class, it's in its own package, right? Something like:

                            import sf.somepackage.Error;

                            Then you'll import your AdobeError as and won't need to refer to Error ambiguously:

                            import errors.adobe.AdobeError;

                            Maybe I'm missing something.

                            TS
                            • 11. Re: Explicite call to top level classes?
                              jfizer Level 1
                              quote:

                              Originally posted by: VarioPegged
                              What happens when you try my suggestion? I might be misunderstanding how you're doing this, but if you import the SF.com Error.as class, it's in its own package, right? Something like:

                              import sf.somepackage.Error;

                              Then you'll import your AdobeError as and won't need to refer to Error ambiguously:

                              import errors.adobe.AdobeError;

                              Maybe I'm missing something.

                              TS


                              I think what you're suggesting would work if I made a SWC with the new AdobeError class in it and then imported it into my project. I just don't like jumping through so many hoops for what should be a trivial problem. I would think that top-level classes would be reference-able by adobe.Error or something to that effect.

                              For now I have a solution in using Object rather then Error, but should I need to actually use the Error class properties later on I'll try what you're suggesting.