Also you should explicitly type the declaration.
public var employeeModel:Object = new Object();

This helps avoid binding issues.

Tracy


-----Original Message-----
From: Scott Barnes [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 22, 2005 6:57 PM
To: [email protected]
Subject: Re: [flexcoders] Passing Models into MXML components...


heh it helps if you initialize the variable inside yoru MXML Component..

public var employeeModel;

should be

public var employeeModel = new Object();

that seemed to have done the trick.....

eg:
--index.mxml---

<mx:Model id="testModel">
<firstName>Scott</firstName>
</mx:Model>

<inco:dspTravelProfile employeeModel="{this.testModel}" />

-- dspTravelProfile.mxml--
<mx:Script>
<![CDATA]
public var employeeModel = new Object();
]]>
</mx:Script>

<mx:FormItem label="First Name:">
<mx:Label text="{employeeModel.firstName}"/>
</mx:FormItem>


On Tue, 22 Mar 2005 11:00:19 -0800, Blake Kadatz <[EMAIL PROTECTED]>
wrote:
> 
> I ran into this as well.  The ugly way around it is to move the code
> from the externally referenced file into the main file.  So in your
> case, that would be put the dspTravelProfile.mxml code into
index.mxml.
> However, for anything more than a small app, that's clearly
> unacceptable.  However, given that it's not able to find certain
> properties, perhaps it's possible to give Flex some hints on where
> employeeModel is being defined so that it's able to resolve references
> across different files?
> 
> Blake
> 
> 
> -----Original Message-----
> From: Scott Barnes [mailto:[EMAIL PROTECTED]
> Sent: Monday, March 21, 2005 9:56 PM
> To: [email protected]
> Subject: [flexcoders] Passing Models into MXML components...
> 
> I have a really weird situation here, basically i have:
> 
> --index.mxml---
> 
> <mx:Model id="testModel">
> <firstName>Scott</firstName>
> </mx:Model>
> 
> <inco:dspTravelProfile employeeModel="{this.testModel}" />
> 
> -- dspTravelProfile.mxml--
> <mx:Script>
> <![CDATA]
> public var employeeModel;
> ]]>
> </mx:Script>
> 
> <mx:FormItem label="First Name:">
> <mx:Label text="{employeeModel.firstName}"/>
> </mx:FormItem>
> 
> When I first save/change the physical mxml and then run, i get this
> message in the compiler:
> 
> "Changes to unknown property, firstName will not be detected."
> 
> -THEN-
> 
> I hit refresh again, and it goes away? Is this just a polite
> exception?  and how do you pass down a byReference as a variable into
> other components? (if its possible)
> 
> --
> Regards,
> Scott Barnes
> http://www.mossyblog.com
> http://www.flexcoder.com (Coming Soon)
> 
> Yahoo! Groups Links
> 
> 
> Yahoo! Groups Links
> 
> 
> 
> 
> 


-- 
Regards,
Scott Barnes
http://www.mossyblog.com
http://www.flexcoder.com (Coming Soon)


 
Yahoo! Groups Links



 







 
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