Saturday, June 13, 2009

Full Screen support in Flex

I recently learned that you can make your Flex application full screen. Here are the steps to accomplish it:

First edit your project's html-template/index.template.html file and add the following allowFullScreen property to the JavaScript code:
else if (hasRequestedVersion) {
  AC_FL_RunContent(
    ...
    "allowFullScreen","true",
    ...
);

You can also add the <param name="allowFullScreen" value="true"/> to the <object> tag, and allowFullScreen="true" to the <embed> tag for compatibility.

Next in your ActionScript code when the application has finished loading (when the stage isn't null) you can make your application full screen like this:
Application.application.stage.displayState = StageDisplayState.FULL_SCREEN;

I found this out from the The Adobe Flex 3 Programming ActionScript 3 PDF on page 547.

4 comments:

Rakesh Sivan said...

Thanks friend, I was desperately searching for this tip ;D

Anonymous said...

I am working in FlexBuilder 3 (Flex SDK 3.5) and I did all you said. I edited the project's html-template/index.template.html. I included the foll. line Application.application.stage.displayState = StageDisplayState.FULL_SCREEN in the . It is not working. What am I missing?

Chris Callendar said...

Sorry, I forgot to reply to this question. Have you had any luck getting it to work?
When are you calling stage.displayState? Make sure it is after the application is completely loaded.
In my example I added a click handler on a button that set stage.displayState = StageDisplayState.FULL_SCREEN;

Anonymous said...

I got it working but the next window which i want to me normal is also in full screen ,how to come back to normal state