Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: AIR and using a NativeWindow as SplashScreen  (Read 10007 times)
snoopy
Newbie
*
Posts: 7


View Profile Email
« 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.
Logged
Joel Hooks
Courseware Beta
Sr. Member
***
Posts: 146


baby steps

 - 46288188  - passport@provinsal.com  - joeltuff
View Profile WWW Email
« Reply #1 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.
Logged

http://joelhooks.com - my ramblings about developing with actionscript and python using pureMVC and django respectively.
snoopy
Newbie
*
Posts: 7


View Profile Email
« Reply #2 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?
Logged
Joel Hooks
Courseware Beta
Sr. Member
***
Posts: 146


baby steps

 - 46288188  - passport@provinsal.com  - joeltuff
View Profile WWW Email
« Reply #3 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 );
}
}
}
Logged

http://joelhooks.com - my ramblings about developing with actionscript and python using pureMVC and django respectively.
snoopy
Newbie
*
Posts: 7


View Profile Email
« Reply #4 on: October 10, 2008, 03:07:21 »

I will give it a try tomororw! Thanks.
Logged
snoopy
Newbie
*
Posts: 7


View Profile Email
« Reply #5 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.
Logged
Pages: [1]
Print