I have a Flash movie to be displayed in fullscreen on a kiosk. Also, It needs to run in a browser window because I'm using JavaScript to reload the page for resetting the movie.
The problem is, it does开发者_开发问答n't go fullscreen when I put the following line to the constructor:
stage.displayState = StageDisplayState.FULL_SCREEN;
But it works fine if I put the line to a button's click handler.
Note: It doesn't work if just call the handler function with a null parameter.
How can I make it fullscreen as soon as it opens?
Due to security restrictions user input is required to goto full screen when playing inside a HTML player.
Quote Adobe docs:
Full-screen mode is initiated in response to a mouse click or key press by the user; the movie cannot change Stage.displayState without user input. Flash runtimes restrict keyboard input in full-screen mode. Acceptable keys include keyboard shortcuts that terminate full-screen mode and non-printing keys such as arrows, space, Shift, and Tab keys. Keyboard shortcuts that terminate full-screen mode are: Escape (Windows, Linux, and Mac), Control+W (Windows), Command+W (Mac), and Alt+F4.
If you are running in a kiosk consider using the stand alone SWF player which doesn' have these restrictions
Simple answer: you can't.
As mentioned in the documentation, you can only change the displayState as a reaction to user interaction, be that a mouse click or key press. This is a usability feature that I wouldn't expect to change any time soon.
Note that this restriction only applies to SWF content running in the browser.
I believe the answer is "you can't". For security reasons, operations like this can only be done on a user event. Otherwise, you could take over the user's desktop and do all kinds of nefarious things like presenting a bogus login dialog.
精彩评论