Hi Nick,

Yes, you can use Meta-data tags to declare an event in your component:
[Event(name="eventname", type="path.to.event.class")]

This will enable code completion for your custom event.

You can then add listeners to your event just as you would to other component 
events.


And no, the parent "shouldn't" dispatch the event, this does cause component 
coupling.

I'm pretty certain though that the people who suggested that did it for the 
sake of simplicity.
In case of a quick-and-dirty prototype, you might not want to extend 
TitleWindow to create a popup, you can simply create an instance of TitleWindow 
and add your content to it, in such a case, you don't have the ability to 
dispatch a custom event from within your popup.

Hope this helps,

Tibor.

www.tiborballai.com


--- In [email protected], Nick Middleweek <n...@...> wrote:
>
> Hi,
> 
> I'm quite new to Flex and was wondering if it's possible to use Meta Tags to
> declare the custom Event that is to be fired from the 'popup' component.
> 
> 
> And then assign that Custom Event to the function handler in the parent MXML
> or AS file?
> 
> 
> I guess this is the same as Geoff and Vaibhav's suggestion? Why do you guys
> suggest that the parent dispatches the event. Doesn't that cause compoenent
> coupling which I understand to be a bad thing?...
> 
> 
> Thanks - as I say, I'm new to this stuff so am curious to the thoughts of
> those in the know...
> 
> 
> Cheers,
> Nick
> 
> 
> 
> 
> 
> 2009/12/18 Fotis Chatzinikos <fotis.chatzini...@...>
> 
> >
> >
> > Either what Valdor suggested, or in your pop window have a "componentOwner"
> > refrence which you use to dispatch your event:
> >
> >
> > popup:
> > public var componentOwner:DisplayObject ;
> >
> >
> > popup dispatches event:
> >
> > componentOwner.dispatchEvent(...your event...) ;
> >
> >
> > application using the popup:
> >
> > thePopUp = new MyCustomPopUp() ;
> > thePopUp.componentOwner = this ;
> > PopUpManager.addPopUp(thePopUp) ;
> >
> >
> >
> > On Thu, Dec 17, 2009 at 10:05 PM, markflex2007 <markflex2...@...>wrote:
> >
> >>
> >>
> >> Hi,
> >>
> >> I want to dispatch event in popup window and capture the event
> >> in base page.
> >>
> >> Please give me a idea how to do this.
> >>
> >> Thanks
> >>
> >> Mark
> >>
> >>
> >
> >
> > --
> > Fotis Chatzinikos, Ph.D.
> > Founder,
> > LivinData Technologies
> > www.styledropper.com
> > fotis.chatzini...@...,
> >  
> >
>


Reply via email to