Fullscreen in Flash Targets, bug or something else?



  • Hello forum,
    Congratulations for this place, looks neat.

    I have a problem with fullscreen in flash targets.
    When opening the swf from a browser ( or even hosting somewhere ), fullscreen doesn't work,
    but it works fine when opening the swf file on the standalone player.

    Is this a flash/browser security thing? I even made a small HTML file to ensure that
    the allowFullScreen parameter is passed to the flash, but still nothing!

    <object width="800"  height="600">
    <param name="allowFullScreen" value="true" />
    <param name="movie" value="game.swf" />
    </object>
    

    Anyone knows what's up?

    I've tested it on chrome, edge and IE, it doesnt work
    Using HaxeFlixel dev branch.
    I am hosting on itch.io, and I'm sure I've seen other webgames there having a fullscreen.

    THANKS!

    p.s. Checkout the game I'm working on https://johndimi.itch.io/tombexplorer



  • @johndimi Due to security restriction the call to open in fullscreen has to come directly from a user input, so if you're using FlxG.keys.justPressed in the update I don't think it will allow it. You need to have the call to open in full screen in the same function stack as the input event.

    If so try something like this and see if it works:

    FlxG.stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
    private function onKeyDown(event:KeyboardEvent):Void
    {
    Lib.current.stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
    }

    Also, I remember Oh Mummy! I only played the first few levels but it bought back so many memories, back when I only had 3 games and that was one of them. Is it a full port or have you changed much? Because I remember it being harder and that the mummies chased you around after you opened their tombs. Or does it just get much harder as you progress?



  • Yes, that's it! What a strange quirk, would never have imagined this.
    Anyway, the fullscreen works but I encountered a huge draw back!

    After FlxGame is initialized I do this:

    FlxG.stage.addEventListener(KeyboardEvent.KEY_UP, function(event:KeyboardEvent) {
    	if (event.keyCode == 113) { // F11 key
    		FlxG.fullscreen = !FlxG.fullscreen;
    	}
    });
    

    Which works fine, but there is one problem!
    Almost all keyboard input doesn't work while on fullscreen !

    Only the arrow keys seem to work.( I am using the FlxG.keys object to process keys)
    However the gamepad is not affected at all.

    I think it's another security measure because adding a trace to my keyboard listener to see what is going on. It seems that only the [arrowkeys, space and tab] get passed to the handler. Again this is only for when running inside a browser, standalone runs just fine..

    FlxG.stage.addEventListener(KeyboardEvent.KEY_UP, function(event:KeyboardEvent) {
    	if (event.keyCode == 113) { // F11 key
    		FlxG.fullscreen = !FlxG.fullscreen;
    	}
            trace('Keycode pressed = ${event.keyCode}');
    });
    

    This is getting too troublesome and I think I might just drop fullscreen alltogether.. :frowning2:

    Anyway.

    The game is based on the OhMummy game but I am taking a more freestyle approach, I am borrowing the mechanics of opening tombs by circling them ,revealing items and avoiding enemies, but I am adding a few others elements as well.

    Currently I am adding levels for an adventure mode, but I think I'll also add an Arcade mode where it's going to be just like the original game, the same repeating level, increasing diff, get a highscore. :smiley:

    Cheers.



  • Aaaaaaaaand itch.io can't go in fullscreen mode....

    I've sent them an email. Awaiting response.

    It's not a big deal, but it's a nice feature to have, even if only supporting the 360 gamepad



  • @johndimi Have you tried exporting as html5 and putting that on itch.io? I have a feeling that might work since I am sure that I have seen web games with full screen on itch. Html5 still has the same security policy though.



  • If I'm not mistaken, there is also a variant of flash target: "flash -web", so besides swf, you get auto-generated web page for it.



  • @HappinessSam

    Yeah, I'll try exporting to html5 once I finish the game, ( right now it compiles but there is nothing going on, just a black screen, probably need to check out my code)

    If that doesn't work out, I'll just provide an executable instead.
    Easier option :smile:



  • @starry-abyss

    Oh ,wasn't aware of that. IndeedIt generates an index.html and the swfobject helper. However it doesn't work as it is.
    The swf object needs to get the allowFullScreen parameter set to true to allow fullscreen! (It's an easy addition)

    But that was not my problem.

    After @HappinessSam pointed out, I needed to have the fullscreen code take place in the same function call as the input event.
    That worked ok,
    but then after going fullscreen, ( inside a browser, not standalone swf)
    the keyboard input dies...

    It is a weird problem and I have decided to drop fullscreen altogether ....



  • Anyone reading this, I just got an email from Itch.io
    They enabled the fullscreen capability for their flash embeds ( yeay )

    Still no keyboard support when fullscreen, but a gamepad is just fine.


Log in to reply
 

Looks like your connection to HaxeFlixel was lost, please wait while we try to reconnect.