How does Mate handle data models? Does it use singletons?
Tracy Spratt, Lariat Services, development services available _____ From: [email protected] [mailto:[email protected]] On Behalf Of Seona Bellamy Sent: Wednesday, April 15, 2009 1:55 AM To: [email protected] Subject: [flexcoders] Mate and sharing data across files Hi guys, I'm not sure that the subject line is all that clear, but I honestly can't think of how best to express it. My brain's just really tied in a knot over this one. Bear with me for a moment and I'll try and explain where I'm coming from and what I'm trying to do. I'm pretty new to Flex as a whole, and have been trying to rework an existing app into the Mate framework. The original app was built when both myself and the other developer were just learning Flex (actually, we learned as we went along) and it quickly spiralled out of control into this complete nightmare of code. It's been decided that Mate is going to be our framework of choice for future Flex development, so I decided to start trying to rebuild our app in it as a learning exercise. I used the Cafe Townsend example (http://mate. <http://mate.asfusion.com/page/examples/cafe-townsend> asfusion.com/page/examples/cafe-townsend) as a basis, and started off. So far so good - I managed to build a login interface, get the login function to call a CFC that looks up the details in the DB, and pass the user off to the main interface if they were in the DB. My problem now comes when I try to populate the main interface with the user's data. This would involve making more calls to other CFCs, passing them the user's ID, and getting back the records that are associated with the current user. The Cafe Townsend example didn't really help much with this, since once you're logged in you're logged in and it doesn't really do anything else with that information. I hunted around a bit and decided that the closest I could find to something that might do what I need is a Model and Injectors. The Weather Widget example (http://mate. <http://mate.asfusion.com/page/examples/weather-widget> asfusion.com/page/examples/weather-widget) works with this, and I tried working it into what I had, but I suspect I've tied myself in a bit of a knot. Despite the fact that FlexBuilder is not flagging any errors, the app crashes the browser every time to try to run it. So I'm obviously doing something wrong. I just can't figure out what. So to summarise: how do I go about storing some data in such a way that it will be accessible to other parts of my application? For example, the user data that is brought back by an event in the MainEventMap needs to be visible to events in the UserEventMap. For that matter, are there any other decent examples out there besides the ones on the Mate website? Cheers, Seona.

