2 Replies Latest reply on Feb 25, 2009 2:06 PM by FlexN00b

    Parsing Remote Data into Model Objects?

    FlexN00b
      Hello,

      I'm new to Flex and I'm trying to find out if my instincts from other environments hold true. I have XML data from a remote API that I'd like to use in my Flex application, specifically from a 37Signals web application.

      When I bring in the remote data into Flex, my instinct is to parse it into data models, then use those models to bind to various UI controls. I'm thinking that it will be easier to create list/detail views if I have the data organized this way versus having to do another remote XML lookup to populate the detail view. I'm thinking it will also help me persist the data using the AIR APIs.

      Most of the information I'm finding wants me to parse the XML into some sort of collection and bind it directly. Can someone tell me if looking toward models is a good approach, or if it's a paradigm/pattern that isn't appropriate?

      If it is a decent approach, any information that shows someone using it would be extremely helpful to me.

      Thanks!

      Scott

        • 1. Re: Parsing Remote Data into Model Objects?
          Sar975
          I create one bindable class and in it put an ArrayCollection of ArrayCollection objects which if you make this a singleton instance class then each module within your flex application can initialize and maintain the ArrayCollection element within this class. This seems to work very well since we are pulling several xml lists throughout a tabbed multi state view flex application. I'm not sure if this is what you are looking for or if you need an example. How are you pulling the data into your application through HttpService calls or you are using bindable Remote objects?
          • 2. Re: Parsing Remote Data into Model Objects?
            FlexN00b Level 1
            That is great info and sounds like the direction I'd like to go. I'm using HttpService calls to pull about 7 or 8 feeds.

            I'm not that familiar with array collections or singletons yet, but I will look into them. If I can just persist the arrays, I probably don't need to bother with SQLite.

            I'm nervous about what will happen when I want to do offline storage of these and then be able to sync the data back online, but I guess I will cross that bridge when I come to it...

            thanks!