Click="dispatchEvent(new Event("doBrowseEvent",true));  //the true in
the second param makes the event bubble.

 

You can listen for that event anywhere "above" the button:

This.addEventListener("doBrowseEvent", doBrowse);

 

In doBrowse(), event.target, returns a reference to the Button and
event.currentTarget, I think, will return the item renderer itself.  If
you have a public property on the renderer, like "data", then you can
get at that value through the reference.

 

Tracy

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of oneworld95
Sent: Friday, November 07, 2008 4:45 PM
To: [email protected]
Subject: [flexcoders] Re: Component as an itemRenderer - outerDocument?

 

Thanks, Tracy. Got an example of this "bubbling event"?

Alex

--- In [email protected] <mailto:flexcoders%40yahoogroups.com>
, "Tracy Spratt" <[EMAIL PROTECTED]> wrote:
>
> You can use parentDocument or Application.application, depending on
your
> precise document model.
> 
> 
> 
> A bubbling event is another solution to consider. With such an event,
> your "precise document model" is irrelevant, and you can listen for
and
> handle the event anywhere in the parent chain that is convenient.
> 
> 
> 
> Tracy
> 
> 
> 
> ________________________________
> 
> From: [email protected] <mailto:flexcoders%40yahoogroups.com>
[mailto:[email protected] <mailto:flexcoders%40yahoogroups.com>
] On
> Behalf Of oneworld95
> Sent: Friday, November 07, 2008 4:07 PM
> To: [email protected] <mailto:flexcoders%40yahoogroups.com> 
> Subject: [flexcoders] Component as an itemRenderer - outerDocument?
> 
> 
> 
> Hi. I have a button in an itemRenderer that references a function like
> this,
> 
> <mx:Button id="btnBrowse" label="Browse" 
> click="outerDocument.doBrowse( event )"/>
> 
> Everything worked fine until I moved this itemRenderer into its own
> MXML file as a VBox component. It gives an error: "Access of undefined
> property outerDocument."
> 
> How do you reference a function in the original MXML page from an
> itemRenderer's MXML? Thanks.
>

 

Reply via email to