AS3 : How to make browser fullscreen?
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: AS3 : How to make browser fullscreen?

  1. #1
    Senior Member
    Join Date
    Apr 2003
    Location
    Seattle
    Posts
    169

    AS3 : How to make browser fullscreen?

    Hello,

    I would like to use AS3 to automatically resize the browser to fullscreen so I can loose all the chrome. I have been experimenting a lot but have been unsuccessful.

    Here's an example of the effect I would like: anasomnia.com
    (there's a fullscreen icon in the bottom right of the browser to trigger the fullscreen)

    I have tried this code, however I ran into trouble:

    Actionscript Code:
    addEventListener(Event.ENTER_FRAME,myFunction);
    function myFunction(event:Event) {
        stage.displayState=StageDisplayState.FULL_SCREEN;
    }

    What happens is that when I test the file in flash CS5.5, the swf navigates fine, but no fullscreen effect occurs. When I export to Flash player 10.2, the file goes fullscreen but then it sticks on the frame where the action is located and the playback begins to flicker. If I create a projector and comment out the fullscreen code, and instead use the fullscreen option under VIEW, the fullscreen kicks in but then the playback fails to work properly. When I take the swf into a browser window, it doesn't respond to the fullscreen code.

    I read a bit about how the embed tag in HTML needs new fullscreen parameters, however this didn't seem to make any difference.

    I know it's doable, just not how....

  2. #2
    Senior Member
    Join Date
    Apr 2003
    Location
    Seattle
    Posts
    169
    I have learned that in order to have the fullscreen take effect, a user must initiate it, so I have successfully created the effect by attaching it to a mouse event. The problem I am having now is that the playback head sticks in fullscreen mode after playing the mc on frame two where a timerFinished function is supposed to move the playback forward to frame 3. The navigation works perfectly without fullscreen mode, however the playback sticks in fullscreen whether in a browser, stand alone projector, or just playing back in flashplayer 10.2. Here's my code if it helps to get a better sense of things (each frame has a stop action associated with it also). I sure hope to hear back from someone on this.....

    Actionscript Code:
    fullscreenMe.addEventListener(MouseEvent.CLICK, fullScreenIt);

    function fullScreenIt(event:MouseEvent):void {
    MovieClip(root).gotoAndPlay('two');
    stage.displayState=StageDisplayState.FULL_SCREEN;}

    And here's the code on frame 2:

    Actionscript Code:
    var titlesTimer = new Timer(11000,1);
    titlesTimer.addEventListener(TimerEvent.TIMER_COMPLETE, titlesTimerFinished);
    titlesTimer.start();

    function titlesTimerFinished(e:TimerEvent):void {
    //trace("timer is finished");   
    MovieClip(root).nextFrame();
    }

    var creditsSound:credits = new credits();
    var creditsChannel:SoundChannel = new SoundChannel();
    creditsChannel = creditsSound.play();


    And here's the code on frame 3:

    Actionscript Code:
    import fl.transitions.Tween;
    import fl.transitions.easing.*;

    function alphaTween(mc,b,f,d) {
        var Alpha:Tween = new Tween(mc, "alpha", Regular.easeIn, b, f, d, true);
    }

    alphaTween(moon1,0,1,7);

    var moonTimer = new Timer(1000,7);
    moonTimer.addEventListener(TimerEvent.TIMER_COMPLETE, moonTimerFinished);
    moonTimer.start();

    function moonTimerFinished(e:TimerEvent):void {
    //trace("timer is finished");   
    MovieClip(root).nextFrame();

    }
    Last edited by llyfre; 06-04-2012 at 11:21 PM. Reason: correction

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width


HTML5 Development Center

Poll by Flashkit.com