I would pass a reference of the model from comp1 to comp2. Perhaps the
Application has both comp1 and comp2?
<comp1 id="c1" />
<comp2 id="c2" theModel="{c1.theModel}" />
Comp2.mxml
----
Var theModel:Object
<mx:Label text="{theModel.userFirstName}" />
Even better may be to provide centralized access to the data model
(depending on what it represents). You could store it on the
application or store it in a ModelLocator (Cairngorm approach).
Matt
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of rgwilson26
Sent: Tuesday, March 14, 2006 7:52 AM
To: [email protected]
Subject: [flexcoders] referencing a datamodel from another component
I am recently starting to work with datamodels in flex 1.5 and am
having a bit of a time trying to pass data around my application. I
figured I would use a data model using a model tag within comp#1. I
will need comp#2 to access and display this data. However I cannot
seem to get comp#2 to see comp#1's datamodel. Instead I get
a "changes to unknown property, comp#1Model, will not be detected".
In comp#2 I have text="{comp#1Model.userFirstName}"
This is my directory strucuture:
main.mxml
---->comp directory
comp#1.mxml
comp#2.mxml
If there is possibly a better approach to passing data around within
an app I am open to suggestions.
Thanks
--
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
--
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/