Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: Which part to parse the loaded xml  (Read 8055 times)
wssbwssb
Newbie
*
Posts: 5


View Profile Email
« on: January 17, 2008, 03:11:19 »

Hi cliff:
   
    I got a question recently.

    I used puremvc in my Flash application and it need a defined xml files to get the data support.
    Then I considered to construct a proxy instance. The proxy instance need the data in this xml file and it in chager of load the xml itself.

    But later on ,I found there are a lot of data get together in this xml file and other proxies need these data,too. Then I have no idea where to put my parse code and also questioned about whether to put the load xml code in that proxy instance.

    Then I think to put the load xml code and parse code into a command.But I'm also think the command can't have the ability to retrieve data from server.

     I'm so confused about this.
   


Thanks

Daniel
Logged
Joel Hooks
Courseware Beta
Sr. Member
***
Posts: 146


baby steps

 - 46288188  - passport@provinsal.com  - joeltuff
View Profile WWW Email
« Reply #1 on: January 17, 2008, 08:36:54 »

Cliff will probably reply with a more correct solution, but since you are frustrated and confused I thought I would offer my solution to your problem.  ;)

I don't think there are any 'rules' against proxies communicating and sharing data, so in your ModelPrepCommand initialize only the XML data proxy. When it has finished loading and parsing the XML send a notification to start another command that adds the other proxies to the system. These proxies can then grab instances of your XML data proxy and go about their business.
Logged

http://joelhooks.com - my ramblings about developing with actionscript and python using pureMVC and django respectively.
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #2 on: January 17, 2008, 10:02:23 »

Daniel,

For an example, please examine the Proxies of the CodePeek application.

In short you've got a big xml tree with smaller xml branches inside it.

You want the proxy in charge of the big tree to snap off the twigs, create the appropriate proxies for them and register the proxies. QED.

The cool thing about it is that if you pass the new proxies references to the nodes in the big tree (rather than copies), then as the data in the twigs (accessed through their proxies) will automatically be updating the data in the big tree.

-=Cliff> 
Logged
wssbwssb
Newbie
*
Posts: 5


View Profile Email
« Reply #3 on: January 20, 2008, 07:23:15 »

Hi Joel Hooks and cliff
   
    thank you for your reply.
    This really help me a lot:)

Daniel
Logged
Pages: [1]
Print