4 Replies Latest reply on Aug 23, 2006 8:17 PM by inlineblue

    Puzzled: typing of results

    Level 7
      I thought if my WebService operation says the resultFormat was "e4x" then I
      could have a result handler
      that could directly stuff the result in an XML object:

      var resultXML:XML = event.target.lastResult[0];

      The problem is that lastResult is a [Object] so I get a hard-typing compile
      error.

      But I can do

      var resultXML:MXL = wsID.myOperation.lastResult[0];

      Now, I do agree that the second form is probably better from a practice
      perspective. But what I really want to know is how does the Flash compiler
      distinguish for implicit Casting between some [Object] types and others?



      --
      ===============================
      Dr. Yechezkal Gutfreund
      Team Macromedia for Mobile Devices
      ===============================


        • 1. Re: Puzzled: typing of results
          inlineblue Level 1
          I'm assuming wsID is of type WebService? The thing is, WebService inherits from Proxy. Proxy is a special entity that can return arbitrary values for any property you request. Essentially, everything returned from Proxy has type *. The type is not known until runtime, so the compiler just let's it go.
          • 2. Re: Puzzled: typing of results
            Level 7
            Is that the same reason why

            Application.application.myCustomMethod(...);

            works?

            (again, I was not aware that mx:Application was a dynamic class) I do see
            that I can extend it. Or is the thing that I am extended, different and
            mx:Application merely acting as a proxy for the class that I extended with
            myCustomMethod()?


            "inlineblue" <webforumsuser@macromedia.com> wrote in message
            news:ecicro$rin$1@forums.macromedia.com...
            > I'm assuming wsID is of type WebService? The thing is, WebService
            > inherits
            > from Proxy. Proxy is a special entity that can return arbitrary values
            > for any
            > property you request. Essentially, everything returned from Proxy has
            > type *.
            > The type is not known until runtime, so the compiler just let's it go.
            >


            • 3. Re: Puzzled: typing of results
              ntsiii Level 3
              Use lastResult only in binding expressions.

              Use event.result in result handlers.

              Tracy
              • 4. Re: Puzzled: typing of results
                inlineblue Level 1
                "Application" is not a dynamic class, but "Application.application" is declared as an Object, which is a dynamic class. The compiler is not able to make any checks so you can put whatever you want after the ".". Proxy is not involved here.