2 Replies Latest reply on Aug 28, 2006 1:19 PM by Mark.P.

    <mx:Model> vs. <mx:HTTPService>

    Mark.P.
      Hi, I downloaded the trial of Flex 2 and love it so far but have a question. From the documents I see I can load my XML with either of these methods and tried them both (Model and HTTPService). But what I can't find out is why I would use one over the other. Can anyone shed some light on these two? Aslo - I found that when I pushed them both to my server I got and error 2148 on the one using HTTPService but not on the one using Model. What's the reason for this?
        • 1. Re: <mx:Model> vs. <mx:HTTPService>
          ntsiii Level 3
          First, they are not exactly comparable. mx:Model is a compile time evaluated data structure, while HTTPService is a runtime data access protocol. The better comparison will be between mx:Model and mx:XML, both compile time data structures:

          mx:Model deserializes the xml into a nested mx:Object structure. You acces the data using dot notation and array notation.

          mx:XML retains the e4x xml structure. You access the data using e4x expressions.

          I have never liked Model because I can not predict exactly how it is going to convert my xml. e4x is so powerful that I would strongly advise using XML(e4x).

          HttpService can return data in either format using the resultFormat property. resultFormat="e4x" means the event.result will be an e4x node(XML). resultformat="object" means event.result will be an mx:Model.

          Tracy

          PS, this is not a Flex Builder question and should go in General Discussion.
          • 2. Re: <mx:Model> vs. <mx:HTTPService>
            Mark.P. Level 1
            great explanation Tracy, thanks for clearing that up.

            -M-