We probably need a little more code to see what is going on, but I'll take a stab in the dark ;-)
 
Have you tried using creationComplete on the Canvas Class and calling a function from there?
<mx:Canvas creationComplete="init()" >
 
private function init():void{
myText.x = 50;
//or what ever...
}
 
 
Hilary
 
www.bridel.org

 
On 8/8/06, Lachlan Cotter <[EMAIL PROTECTED]> wrote:
Hi List,

 
I have a question about the initialisation rules for MXML components. My situation is as follows:

 
I have defined a custom MXML component that extends the Canvas class (myComponent).

 
MXML root node of the file, I put a Text element, assigning it an ID (myText).

 
I define a setter method on this class (myProperty) that takes a String argument and passes it to myText.text.

 
I use the custom component in the application, with a tag like this:

 
<local:MyComponent myProperty="a value" />

 
Sure enough the instance is created and the setter method is called. However, an error results when I try to access the property of the child Text object. Apparently it has not been initialised when the method is called. This results in an error (setting a property on a null object).

 
My question is if this is the expected behaviour and if there is a way to achieve this with MXML (setting properties of child objects from a setter method called at init time).

 
Thanks for any insights.

 
Cheers,
Lach


 

 



--
Hilary

-- __._,_.___

--
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 Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to