• June 8, 2008

    Freaky fscommand issues in Flash Player 9 and as2 project

    I spent couple of hours trying to figure this one out, so at the end of my thorny journey I decided to share this with all of you.

    I have a lot of old standalone projector AS2 Flash 8 projects. Each one begins with fscommands that switch player to fullscreen and setup rest of the stuff.

    fscommand("allowscale","false");
    fscommand("fullscreen", "true");
    fscommand("trapallkeys", "true"); 
    fscommand ("showmenu", "false");
    
    escKey = {};
    escKey.onKeyDown = function(){
        if(Key.getCode() == Key.ESCAPE){
            fscommand("quit", "");
        }
    };
    Key.addListener(escKey);
    fscommand("trapallkeys", "true");

    Well, that worked just fine before Flash 9. But today I had to build a simple AS2 game and wanted to do the same - upon starting, goto fullscreen, send all key events... Upon publishing, my game didn't want to go to fullscreen. To make things even more stranger - not even pressing CTRL+F didn't switch to fullscreen! As it turned out,
    fscommand("trapallkeys", "true");

    was causing problems. After commenting that line out everything worked fine... except capturing of key events - a major factor to my game.

    But, BEHOLD! Few hours later, a magical combination of TRUE, true, and false, FALSEs, finally worked out:

    fscommand("allowscale","FALSE");
    fscommand("fullscreen", "TRUE");
    fscommand ("showmenu", "false");
    fscommand("trapallkeys", "true"); 

    Why is this happening, I don't, but I am glad I made it work. More people reported similar problems with fscommand in Flash 9:

Reader comments:

  1.  

    June 16, 2010 @ 13:28

    ga says:

    thanks man,..

  2.  

    January 11, 2012 @ 09:09

    Migdalia Oas says:

    Thanks this is very informative . Bookmarked your website

Have your say:

 
This blog is Gravatar friendly. Don't have Gravatar? Get one fast!
 

Proudly running on Word Press, and above all, proudly using Comic Sans.

Nivas.hr © Copyright 2009    All right reserved    Made in Croatia Yeah, we made our own site!Nivas.hr