Thanks, Dominick. The reason I am using declarative instantiation is because this code is generated from a database. Our technology lets you build complex client-side logic using an ide, then generate an mxml logic component, like a mega-validator. In one mode it generates the component using the mx:Application tag, so the component can be used as the root tag af an application, so it really needed to be mxml. It is difficult to build an app without an mxml application file.
Theoretically, I could generate AS code, but to change would take me months. I am really migrating a functionaing Flex 1.5 app to 2.0. I have solved this with a bit of logic, and am reasonably satsfied with the solution. Thanks for your response! Tracy ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Dominick Accattato Sent: Wednesday, December 06, 2006 12:21 AM To: [email protected] Subject: Re: [flexcomponents] Component initialization, binding, null references Tracy: To me it seems your trying too hard to make the problem a declarative problem. The more elegant solution would just having the TestParam instantiated through actionscript in a <mx:Script> Also make that variable [Bindable] and you then have your solution, and then you can have a parent property inside it. The way you are currently doing it will cause it to have a circular reference. Be sure to also test for null in the leParameter setter. There are probably other ways as well, but they may not be as elegant as you desire. I know it seems elegant to just declare everything in mxml tags, but the On 11/20/06, Tracy Spratt <[EMAIL PROTECTED]> wrote: I have two " faceless" custom components, "Parameter" and " LEValue" , neither extend a stock class . Parameter is like a value object and LEValue is a smart attribute of Par ame ter. Get/Set functions in Parameter put its "value" attribute in an LEValue object property. The components are instantiated in mxml The problem is that on initialize of the application , the Parameter' s value attribute is being set (Setter is trying to access LE Value.value) before the LEValue object is initialized, and I get a null reference error. Here is the mxml that instantiates the two components: <ltle:LEValue id="Testparm_value" leParameter="{Testparm}" /> <ltle:Parameter id="Testparm" leValue="{Testparm_value}" value="AAA" /> As you see, I want both components to be aware of each other. If I test for leValue != null in the Parameter set value function, then everything works ok after initialize is complete. But the initial value "AAA " is not set into the LEValue property. I have bounced around trying different things, and am sure I can throw enough code at the problem to make it work, but I' d like to do it simply and ef ficiently! Any suggestions will be welcome. Including directed RTFMs! Tracy Spratt -- Dominick Accattato, CTO New View Networks www.newviewnetworks.com
