Doug,

Tim's exactly right, and that's fundementally what the Cairngorm 
ModelLocator does - provides an object that can store lots of other objects.

In your case it might look something like this:  (mind you, this is 
oversimplified)

ModelLocator:Object (or call it SharedObject or whatever you like)
contains a RecordSet:ArrayCollection
which contains 1 to many Record:Object
where each has 1 to many attributes, such as name:String, address:String, 
phone:String...

Your ModelLocator would also store a pointer to the currently selected 
Record:Object, unless no Record is selected.  You bind the fields in your 
Views to the pointer and poof, you get populated fields when there's a 
selected record and empty fields when there's no selected record.  Want to 
create a new Record?  Create a function that gathers up all the data from 
the fields and uses the data to create a new Record:Object and add it to the 
ArrayCollection in the ModelLocator when the user presses "add."

I'm a big fan of Cairngorm, and it seems like half the questions/problems 
asked here could be solved by one of the features of Cairngorm - but 
especially questions pertaining to the ModelLocator and binding Views to 
centralized data.  You might want to look into Steven Webster's Cairngorm 
.99 article, if only to get a better idea of how to fit a ModelLocator type 
pattern into your application.

Darren


>From: "Tim Hoff" <[EMAIL PROTECTED]>
>Reply-To: [email protected]
>To: [email protected]
>Subject: [flexcoders] Re: Multiple instances
>Date: Fri, 02 Jun 2006 01:14:16 -0000
>
>Hi Doug,
>
>Is there some reason why you can't use a single ArrayCollection
>dataProvider to hold all of the data.  If all of the data is in a
>single object, you can avoid having to create multiple instances of
>the same view, unless that is the desired effect.  Depending on the
>complexity of each record, each row of the ArrayCollection would
>represent a seperate instance of the data.  Each instance would be
>indentified by it's index.  When the user hits the next or previous
>button, you simply increase or decrease the selected index.  This
>approach would also allow for empty records (array elements). When
>the user adds a record, you would simply append the array with a new
>element.  Not knowing exactly what you are trying to do makes this
>just a guess.  But, from what I've read it sounds possible. :)
>
>-TH
>
>
>--- In [email protected], "Doug Arthur" <[EMAIL PROTECTED]>
>wrote:
> >
> > Thank you very much for you reply.
> >
> > I guess that's what I'm looking for, binding my interface to data.
>I need to
> > have the functionality of a user clicking "add new record" and all
>the
> > fields empty, and new instance of data can be filled out, while
>the other
> > instances of data still exist in memory.
> >
> > So, one view and multiple data instances for that single complex-
>view
> > (modulized in multiple components). Each instance of data needs to
>be
> > indentifiable, and can page through each instance with a next
>button.
> >
> > Here's what I've researched between then and now. I can create a
>singleton
> > and implement the getInstance() method using the
> > SharedObject.getLocal(data_name,
> > data_location...) and instantiate the class with data for each
>paged record.
> >
> > Am I on the right track? Are there examples out there with this
>for Flex 2.0.
> > I haven't been able to get most examples to work. Although, I have
>been able
> > to successfully instantiate multiple instances of data, just not
>bound to
> > one view yet. I'm starting to get the hang of it and don't see it
>being as
> > hard as it looked when I originally sent this message. But
>feedback and
> > suggestions is much appreciated, so please let me know if I'm on
>the right
> > track everyone.
> >
> > Thanks!
> > - Doug
> >
> >
> > On 6/1/06, Darren Houle <[EMAIL PROTECTED]> wrote:
> > >
> > >  Doug,
> > >
> > > I think maybe the lack of replies might be due to the fact you
>haven't
> > > asked
> > > a question yet.  "Need assistance" is very vague.  Specifically
>what do
> > > you
> > > need assistance with?  Are you having trouble somewhere in your
>custom
> > > mxml
> > > components?  Are you looking for a way to bind your interface to
>data?  If
> > > I
> > > had to guess I'd say you're looking for a way to bind your
>interface to
> > > data, but also provide a way to offer those same pages blank, so
>a user
> > > can
> > > fill them out to create new records...?
> > >
> > > Darren
> > >
> > >
> > >
> > >
> > >
> > > >From: "Doug Arthur" <[EMAIL PROTECTED]>
> > > >Reply-To: [email protected]
> > > >To: [email protected]
> > > >Subject: [flexcoders] Re: Multiple instances
> > > >Date: Thu, 1 Jun 2006 08:42:58 -0500
> > >
> > > >
> > > >Wow, it amazes me how active this group is, but I yet to get an
>answering
> > > >from anyone on this problem. Does anyone have any suggestions
>for me at
> > > >all?
> > > >
> > > >Thanks!
> > > >- Doug
> > > >
> > > >
> > > >On 5/31/06, Doug Arthur <[EMAIL PROTECTED]> wrote:
> > > >>
> > > >>  I hope I form my question and problem adequate enough for
>everyone to
> > > >>understand.
> > > >>
> > > >>I'm still fairly new to flex and I'm trying to do something
>complicated,
> > > >>at least in my mind it is.
> > > >>
> > > >>What I'm trying to do is to have multiple instances of the
>below code
> > > with
> > > >>different data. I have pages broken out into multiple mxml
>components.
> > > >>Each
> > > >>components has data driven values on it, but what i need is to
>have
> > > >>multiple
> > > >>instances of data and to propagate the data through the pages
>to their
> > > >>respective components... The purpose of this is to use
>a "Previous/Next
> > > >>Record" process. This include non-existent records, what I
>mean by this
> > > is
> > > >>that a user can enter multiple records in a given time with
>a "Add New
> > > >>Record" action. And also a "Delete Record" action.
> > > >>
> > > >>I hope this all is clear, please, any assistance would be much
> > > >>appreciated. Thanks!
> > > >>
> > > >>
> > > >>
> > > >>
> > > >>
> > > >>Here's the code example (really high level):
> > > >>  <mx:HBox width="100%" height="100%">
> > > >>   <mx:TabNavigator height="100%" width="100%">
> > > >>    <recorddata:Overview />
> > > >>    <recorddata:Charges />
> > > >>    <recorddata:Dispositions />
> > > >>    <recorddata:Actions />
> > > >>    <recorddata:Fees />
> > > >>   </mx:TabNavigator>
> > > >>  </mx:HBox>
> > > >>
> > > >>
> > > >>
> > > >>- Doug
> > > >>
> > >
> > >
> > >
> > >
> > > --
> > > Flexcoders Mailing List
> > > FAQ:
>http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> > > Search Archives: http://www.mail-archive.com/flexcoders%
>40yahoogroups.com
> > >
> > >
> > >
> > > SPONSORED LINKS
> > >   Web site design development<http://groups.yahoo.com/gads?
>t=ms&k=Web+site+design+development&w1=Web+site+design+development&w2=
>Computer+software+development&w3=Software+design+and+development&w4=M
>acromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig=L
>-4QTvxB_quFDtMyhrQaHQ> Computer
> > > software development<http://groups.yahoo.com/gads?
>t=ms&k=Computer+software+development&w1=Web+site+design+development&w
>2=Computer+software+development&w3=Software+design+and+development&w4
>=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig
>=lvQjSRfQDfWudJSe1lLjHw> Software
> > > design and development<http://groups.yahoo.com/gads?
>t=ms&k=Software+design+and+development&w1=Web+site+design+development
>&w2=Computer+software+development&w3=Software+design+and+development&
>w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.s
>ig=1pMBCdo3DsJbuU9AEmO1oQ>  Macromedia
> > > flex<http://groups.yahoo.com/gads?
>t=ms&k=Macromedia+flex&w1=Web+site+design+development&w2=Computer+sof
>tware+development&w3=Software+design+and+development&w4=Macromedia+fl
>ex&w5=Software+development+best+practice&c=5&s=166&.sig=OO6nPIrz7_EpZ
>I36cYzBjw> Software
> > > development best practice<http://groups.yahoo.com/gads?
>t=ms&k=Software+development+best+practice&w1=Web+site+design+developm
>ent&w2=Computer+software+development&w3=Software+design+and+developme
>nt&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166
>&.sig=f89quyyulIDsnABLD6IXIw>
> > >  ------------------------------
> > > YAHOO! GROUPS LINKS
> > >
> > >
> > >    -  Visit your
>group "flexcoders<http://groups.yahoo.com/group/flexcoders>"
> > >    on the web.
> > >
> > >    -  To unsubscribe from this group, send an email to:
> > >     [EMAIL PROTECTED]<flexcoders-
>[EMAIL PROTECTED]>
> > >
> > >    -  Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> > >    Service <http://docs.yahoo.com/info/terms/>.
> > >
> > >
> > >  ------------------------------
> > >
> >
>
>
>
>
>
>
>
>--
>Flexcoders Mailing List
>FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
>Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
>Yahoo! Groups Links
>
>
>
>
>
>




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Protect your PC from spy ware with award winning anti spy technology. It's free.
http://us.click.yahoo.com/97bhrC/LGxNAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~-> 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to