PureMVC Architects Lounge

Announcements and General Discussion => General Discussion => Topic started by: snoopy on October 10, 2008, 10:01:24



Title: AIR and using a NativeWindow as SplashScreen
Post by: snoopy on October 10, 2008, 10:01:24
Hello

I am trying to use PureMVC together with Adobe AIR. I am currently trying to use a NativeWindow in AIR as a splash screen for my PureMVC project. The idea is that this window shown during the time I am trying to load the configuration file and the templates directory.

Now I am not sure how to use PureMVC together with new NativeWindows. I am planning to have two extra windows in my application besides the main window (of WindowedApplication).

Does anyone have experience with making splash screens and use a NativeWindow for this? What would be the best approach when using PureMVC?

I would think about something like starting the application with the main window hidden (using the manifest file) and then create somewhere this native window and then listen for VIEW_APP_WINDOW where I then kill the splash screen window and show the application/main window.

Thanks! Oh yeah, I am a PureMVC noob.


Title: Re: AIR and using a NativeWindow as SplashScreen
Post by: Joel Hooks on October 10, 2008, 01:19:36
I use the main window for my splash screen and then hide it later. I turn off all the chrome and center it to the main screen. I then pop new windows for my other views because I generally want chrome on them.


Title: Re: AIR and using a NativeWindow as SplashScreen
Post by: snoopy on October 10, 2008, 02:26:30
Yes, thanks. I am just curious how you would deal with the creation of such NativeWindow-instance where this should be put in the PureMVC architecture.

I was thinking about:
var theWindowOptions: NativeWindowInitOptions = new NativeWindowInitOptions();
var theWindow: NativeWindow = new NativeWindow(theWindowOptions );

etc.

Where would I put this code?


Title: Re: AIR and using a NativeWindow as SplashScreen
Post by: Joel Hooks on October 10, 2008, 02:31:18
I put it in a command. I generally use windows as wrappers only (with the idea that maybe this will one day want to be a web app), but since I also want to pop the windows from multiple locations, the command works very well. Generally something like this:
:
public class MyWindowOpenCommand extends SimpleCommand implements ICommand
{
override public function execute(notification:INotification):void
{
var myWindow:MyWindowWindow;
var myWindowMediator:MyWindowMediator;
if( ! facade.hasMediator( MyWindowMediator.NAME ) )
{
myWindow = new MyWindowWindow( )
myWindowMediator = new MyWindowMediator( myWindow )
facade.registerMediator( myWindowMediator );
myWindow.open();
myWindow.nativeWindow.x = (Screen.mainScreen.bounds.width - myWindow.nativeWindow.width) / 2;
myWindow.nativeWindow.y = (Screen.mainScreen.bounds.height - myWindow.nativeWindow.height) / 2;
}
else
{
myWindow = MyWindowWindow( facade.retrieveMediator( MyWindowMediator.NAME ).getViewComponent() )
myWindow.activate()
myWindow.orderToFront();
myWindow.nativeWindow.notifyUser( NotificationType.INFORMATIONAL );
}
}
}


Title: Re: AIR and using a NativeWindow as SplashScreen
Post by: snoopy on October 10, 2008, 03:07:21
I will give it a try tomororw! Thanks.


Title: Re: AIR and using a NativeWindow as SplashScreen
Post by: snoopy on October 12, 2008, 04:37:28
Thanks! I have it working.

I have put the viewing stuff in the SplashScreenMediator-class and then sending a SHOW-notification from the ShowSplashScreenCommand.