How to get full screen in flash.(fs command)

Dani AI

Generated

Good question, . The answer depends on where your SWF runs.

  • Projector app (.exe/.app): If by "fs command" you mean FSCommand, that is only for standalone projectors. You can toggle fullscreen like this:
// Projector only (not in a browser)
fscommand("fullscreen", "true");   // enter
fscommand("fullscreen", "false");  // exit
  • In a browser: FSCommand will not make the plugin go fullscreen. is right to point you to the Stage API. Two gotchas often missed:
    1. Your HTML embed must allow it:
<!-- OBJECT tag -->
<param name="allowFullScreen" value="true" />

<!-- EMBED tag (if used) -->
<embed ... allowFullScreen="true" />
  1. Entering fullscreen must be triggered by a user action (click, key press). You cannot auto-enter on load, and Esc always exits. If it seems to do nothing, check the permission at runtime:
if (!stage.allowsFullScreen) {
    // Inform the user or adjust your UI (the HTML embed likely lacks allowFullScreen="true")
}

UX tips so it looks right in fullscreen:

  • Control scaling yourself and realign on resize:
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
stage.addEventListener(FullScreenEvent.FULL_SCREEN, onFullScreenToggle);
stage.addEventListener(Event.RESIZE, onResize);

function onFullScreenToggle(e:FullScreenEvent):void { onResize(); }
function onResize(e:Event = null):void {
    // Reposition/scale your content to maintain aspect ratio, center, etc.
}

Hope that adds the missing context around ’s snippet. And thanks for the nudge to expand on it.

Recommended Answers

All 2 Replies

How to get full screen in flash.(fs command)

Have you got any more info??
What exactly are you trying to do?
What version of flash/actionscript are you using?

To make a .swf fullscreen in AS3 you can do this:

stage.displayState = StageDisplayState.FULL_SCREEN;

and to go back to the normal windowed mode you can use:

stage.displayState = StageDisplayState.NORMAL;

NOTE: In order to use StageDisplayState in your AS3, you'll need to make sure you import flash.display.StageDisplayState.

Not sure if that's any help to you, but you haven't exactly given us a lot to go on!

Cheers for now,
Jas.

Thanks Janson.
You share good knowledge.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.