What’s the error? Are you working
with strongly typed objects? If so, does the object have the properties you’re
trying to access declared?
The key to binding is to use strong types
(as Tracy
pointed out). There are other binding debugging tips listed on my blog and in
the docs (which for 1.5 is actually an updated version of my old blog post).
Matt
From: Scott Barnes
[mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 22, 2005 8:53
PM
To: [email protected]
Subject: Re: [flexcoders] Passing
Models into MXML components...
oops thought I had that heh.
I did however find another stumbling block and
that is if have a
nested child within that object...
employeeProfile.TRAVEL.PASSPORT.fName =
"Scott"
that will throw the error again (as the compiler
seems to throw a
darky if the object doesn't physically exist when
it goes to compile
or something along those lines)
On Tue, 22 Mar 2005 23:50:39 -0500, Tracy Spratt
<[EMAIL PROTECTED]> wrote:
>
> 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
>
>
>
>
>
--
Regards,
Scott Barnes
http://www.mossyblog.com
http://www.flexcoder.com
(Coming Soon)
| Yahoo! Groups Sponsor |
ADVERTISEMENT
![click here]() | |
![]() |
Yahoo! Groups Links