PureMVC Architects Lounge

Announcements and General Discussion => Getting Started => Topic started by: vladakg85 on August 14, 2009, 05:46:35



Title: Native window and PureMVC
Post by: vladakg85 on August 14, 2009, 05:46:35
I make NativeWindow component (based on script from TourDeFlex application). But I don't know how to implement PureMVC on native component. Is there any code sample, or can somebody show some simple viewComponent-mediator example. Just how to catch event from button from native component.

Thanks


Title: Re: Native window and PureMVC
Post by: puremvc on August 15, 2009, 06:27:27
It is like any other component that you can reference or place a listener on. You might have a look at the DesktopCitizen utility and the CodePeek and RSS Reader AIR apps that use it.

-=Cliff>


Title: Re: Native window and PureMVC
Post by: vladakg85 on August 18, 2009, 04:41:30
Ok, but my current component is something like popup (it is my update window). Where to register mediator for it? I send notification from startup command to see if  there is new version and based on result this native window should be opened, but I need to register mediator somehow or application break.
:
faca.registerMediator(new myNativeComponent(?));


Title: Re: Native window and PureMVC
Post by: puremvc on August 18, 2009, 08:09:19
Register the mediator at the same time you create the window, just as you would with any other object where instantiation has been deferred.

Have a look at Simon Bailey's post on handling Popups: http://www.nutrixinteractive.com/blog/?p=329

In his case it isn't a native window, but a Flex TitleWindow popup but the concept is the same. You need to create the popup, wrap a mediator around it and then have it removed when the window goes away.


-=Cliff>