Alex
Alex

Reputation: 258

Adobe Air application maximum window size - how to set?

I've an Air application, which I want to maximize at the startup. I set the width and height value to 100% but it didn't help me. I've tried to set the percentWidth, percentHeight values to 100 but it didn't work neither.

<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/mx"
                   width="100%" height="100%"

All the components properties are set to 100% but the application doesn't start in maximum size. How should I set them properly? Thank you!

Upvotes: 0

Views: 1431

Answers (1)

RIAstar
RIAstar

Reputation: 11912

The WindowedApplication instance is not the window itself, but it runs inside a native window. So by setting width="100%", you're effectively saying: take up the entire width of the native window. Hence you're not resizing the window itself.

You can access this native window your application is running in through WindowedApplication's nativeWindow property. This returns an instance of the NativeWindow class, which in turn has a maximize() function.

So to maximize your application simply do this inside the WindowedApplication instance:

nativeWindow.maximize();

Upvotes: 3

Related Questions