Flash: Full Screen Video

June 15th, 2006 by Luis

[UPDATE:]
Flash: Full-Screen Mode
Flash full-screen mode and Flash Player Update 3 Beta 1 (build 9.0.60.120)

This is just an attempt to create a full screen Flash Video piece (original video size 360 x 204), trying to keep a decent quality by using Video.smoothing property

You can see the result here: Full Screen FLV.

Actionscript:
  1. Stage.align = "TL";
  2. Stage.scaleMode = "noScale";
  3. Stage.showMenu = false;
  4. var timeline:MovieClip = this;
  5. var _minW:Number = 360;
  6. var _minH:Number = 204;
  7.  
  8. var video_container:MovieClip = timeline.attachMovie ('video_container', 'video_container', timeline.getNextHighestDepth ());
  9.  
  10. function onResize ()
  11. {
  12.     var scaleY:Number = Math.round (100 * (Stage.height) / _minH);
  13.     var scaleX:Number = Math.round (100 * (Stage.width) / _minW);
  14.    
  15.     var scaleFactor:Number = Math.min (scaleY, scaleX);
  16.  
  17.     if (scaleFactor> 100) video_container._xscale = video_container._yscale = scaleFactor;
  18.  
  19.     video_container._x = Math.round ((Stage.width / 2) - (video_container._width / 2));
  20.     video_container._y = Math.round ((Stage.height / 2) - (video_container._height / 2));
  21. }
  22.  
  23. var connection_nc:NetConnection = new NetConnection ();
  24. connection_nc.connect (null);
  25. var stream_ns:NetStream = new NetStream (connection_nc);
  26. video_container.my_video.attachVideo (stream_ns);
  27. video_container.my_video.smoothing = true;
  28. stream_ns.play ("riding_giants_m480[1].flv");
  29.  
  30. Stage.addListener (this);
  31.  
  32. onResize ();


You can download the source files here. (The video is not included)

Related Links:

19 Responses to “Flash: Full Screen Video”

  1. Tino Says:

    Very nice solution for displaying flv kind-a-fullscreen. I’m still struggeling how to implement fullscreen for flv. If you use _blank, the underlaying flv keeps also loading. If you use as target the same window, you have to implement a back button…
    I’m testing the last option. try http://media.cpp.nl/mp2 . If you click emmen-lingen you get a fullscreen button. I have implemented your source now.

  2. lessrain blog » Blog Archive » Flash: Standalone Video Player Says:

    […] all the FLV in your system). Realated entries: FLV and Wordpress Flash: FLV resources Flash: Full Screen Video Flash Video category

                        This entry was posted
    
     [...]
    
  3. Visitor Says:

    Hey, a nice demo! But there’s a problem, I can’t access the source files. I get the error ” The requested URL was not found on this server.”

  4. Visitor Says:

    I tried downloading and opening the fla file in Flash MX 2004 Version 7.0 and I can’t open the .fla file. Can you do a File > Save As and save the .fla file as a “Flash MX Document” instead of a “Flash MX ? Document”?

  5. Mark Says:

    hey ive been looking everywhere for a piece of code like this, though what i really need is a button that when clicked will put flv at full screen, would happen to you know what actionscript to attach to the button? thanks

  6. Mari Says:

    Just wanted to say thanks supplying the source files… this is a good solution to fullscreen. I was just streching the swf by publishing it at 100% but this looks alot better.

    Thanks!

  7. lessrain blog » Blog Archive » Flash: Full-Screen Mode Says:

    Flash: Full-Screen Mode.

  8. Marc Says:

    Anyone know why the fla won’t open in flash mx 2004?

  9. COMRAD » Blog Archive » flash video tut Says:

    […] « Forest Floor flash video tut http://www.blog.lessrain.com/?p=434 http://www.flashcomguru.com/index.cfm/2006/5/26/fullscreenflashvideo This entry was posted […]

  10. Damien Jorgensen - Cardiff Says:

    I wish WMP would support FLVs, it would make it all far easier

  11. agnieszka Says:

    hey
    great solution — can flv loop though???

    http://byroofs.com/v4.0/index_exp.html

  12. Johnny Says:

    hi
    is there anyway of looping the video without extending the time line please.
    Not a developer by the way
    Cheers
    Johnny

  13. Mr.doob Says:

    Looping a video:
    http://mrdoob.com/blog.php?postid=460

    ;)

  14. jaxx Says:

    What you really need is a yutube like proper fullscreen vid so I got this to work.. http://jaxxrr.110mb.com/other/fs2.html
    and heres the sourcecode
    http://jaxxrr.110mb.com/other/flash-fullscreen.zip
    nothing special really.. one line of script on a button

    on (release) {
    Stage.displayState = “fullScreen”;
    }

    BUT you need to have the following parameter set to true

    either

    or
    ACFLRunContent( … “allowFullScreen”, “true”, … )

    cheers

  15. jaxx Says:

    the last code did not display, what I ment was to edit the html file and set the allowFullScreen parameter from false to true and make sure your file is not overwritten when compiling but unchecking html in publish settings

  16. J Says:

    jaxx,

    your solution:

    on (release) {
    Stage.displayState = “fullScreen”;
    }

    seems to work, but my images and the entire flash movie turn out pixelated. Any solutions for this?

    Thanks for all your help!

  17. chad Says:

    maybe i put the last comment in the wrong place…

    how would you go about making a xml playlist of flv’s to work along with this?

    thanks

  18. mike j. Says:

    hey guys,

    i just build up my own netstream flv player (first of all just for learning coding). but i have a problem with my fullscreen mode.
    you can find the .fla under http://www.mikejungwirth.com/downloads/ff_flvPlayer.zip

    if soomeone could help me out. i have the problem that the video is inside its own movieclip. good to attach via as code but the flash is actually greater than the video source is. so, if i click on fullscreen it scales the flash up and not just the video.

    thanks for help!

  19. ben Says:

    great demo thanks!

    any idea how to add content above it in flash, everything seems to sit behind the video?

    cheers

Leave a Reply