On 5/10/06, bhaq1972 <[EMAIL PROTECTED]> wrote:

> here's an interesting one.
>
> if i add another child to myComponent (a mx:Button), it thinks the
> parentDocument is the root application and not comp1 (see below).
>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*">
>    <mx:Box id="box1">
>         <myComponent id="comp1"/>
>    </mx:Box>
> </mx:Application>
>
>
> myComponent.mxml
> ----------------
> <mx:HBox>
>    <myButton/>
>    <mx:Button initialize="trace(this.parentDocument)"/>
> </mx:HBox>
>
> myButton.mxml
> -------------
> <mx:Button initialize="trace(this.parentDocument)"/>

That's right. The 'parentDocument' of the 'comp1' is the application.
When a UIComponent is the document itself, its 'parentDocument'
property points to its parent's document.

if (this == this.document)
{
   this.parentDocument = this.parent.document;
}
else
{
   this.parentDocument = this.document;
}


--
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