PureMVC Architects Lounge

Announcements and General Discussion => General Discussion => Topic started by: janberc on March 30, 2009, 02:15:29



Title: DesktopCitizen and Main Window's visibilty
Post by: janberc on March 30, 2009, 02:15:29
Hi,
I am creating an AIR application which has a splash screen which opens from the main MXML file. The splash screen is a window object which opens from the main app mediator and I keep the visibility of the main MXML to false till the splash is played completely. But when I use DesktopCitizen, the main MXML shows up for sometime (fraction of a second), then disappear, shows the splash screen. Any help will be much appreciated.

-JB


Title: Re: DesktopCitizen and Main Window's visibilty
Post by: puremvc on March 30, 2009, 03:45:17
Are you able to build and run the CodePeek AIR app? Does it do this on your machine? What you describe should not happen.

Is the base tag of your AIR app Application or WindowedApplication? If the latter, try using the former. I have had bizarre things happen when using WindowedApplication. I reported this in person to Mike Chambers many moons ago, but never filed an official bug report. Mike indicated at the time that there was no real benefit to using one over the other. So far I've found that to be true and have continued to use the Application tag.

To see what I'm talking about, get the CodePeek app and run it normally to see the behavior it should display, then change the main tag to WindowedApplication and run it again.

-=Cliff>


Title: Re: DesktopCitizen and Main Window's visibilty
Post by: janberc on March 30, 2009, 03:54:16
Hi Cliff,
I will take a look at Code Peek. I was under the impression that WindowedApplication tag has more functionality built in for a desktop application. I will check and try your suggestions and get back. Thanks for the quick reply.

-JB


Title: Re: DesktopCitizen and Main Window's visibilty
Post by: puremvc on March 30, 2009, 04:01:49
If you figure out what that 'extra functionality' actually is, by all means, post it here, but I've not yet found a good reason to use it. I get by just fine with Application. I'm sure that there is some stuff there, but until I need it, it's like super-sizing your medium drink to a barrel-o-coke for just a quarter more. If you're not that thirsty, then why do it?

-=Cliff>


Title: Re: DesktopCitizen and Main Window's visibilty
Post by: Ondina on March 31, 2009, 02:36:06
Even the simplest WindowedApplication behaves like this.

If in  your descriptor file ( DesktopCitizenTest-app.xml) you have

<visible>true</visible>
<systemChrome>none</systemChrome>

you'll see something (the rectangle of the window without any chrome) before the WindowedApplication builds the window with the FlexChrome.

Solution:
set visible explicitly to false
<visible>false</visible>
The default is false, but it seems not to work.

Maybe that was your problem.

Ondina


Title: Re: DesktopCitizen and Main Window's visibilty
Post by: janberc on April 16, 2009, 08:34:17
I can't use <mx:Application instead of WindowedApplication. Immediate problem was I dont have activate() method of WindowedApplication class.

I tried setting the visible to false and transparent to true in the ApplicationDescriptor.xml file. This also doesnt work for me. May be there is something we need to check in the DesktopCitizen class?

-JB


Title: Re: DesktopCitizen and Main Window's visibilty
Post by: puremvc on April 16, 2009, 11:50:19
So far we've not been able to determine why the WindowedApplication class behaves differently from Application with regard to DesktopCitizen's implementation. When I spoke with him on the AIR Bus Tour, Mike Chambers wasn't able to explain it either. feel free to have a look, and please do report any good findings, but so far I'm stumped.

-=Cliff>


Title: Re: DesktopCitizen and Main Window's visibilty
Post by: Ondina on April 16, 2009, 11:51:09
Now that I'm reading your first post again, I see your “real” problem, or so I think.

You set WindowedApplication visible=false.
Then on applicationComplete you initialized the PureMVC apparatus:
Facade, ApplicationMediator, DesktopCitizenMediator

Your additional window is created and opened in the ApplicationMediator and you expect the  WindowedApplication to not be visible until the added window has finished its work.

But the DesktopCitizenMediator has already set the
stage.nativeWindow.visible = true; when handling the notification WINDOW_SHOW

and that happened before you created your additional window.

That's why you see the  WindowedApplication for a short while.

You have to put
sendNotification( DesktopCitizenConstants.WINDOW_OPEN, app.stage );

there where you consider that your additional window has finished its work or where you wanted your  WindowedApplication to be visible again.

It will work!

Ondina


Title: Re: DesktopCitizen and Main Window's visibilty
Post by: puremvc on April 17, 2009, 05:15:23
Thanks for catching this one Ondina, you rock!

-=Cliff>