Fullscreen with ActionScript 3


/ Published in: ActionScript 3
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <!-- HTML -->
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
  4. <head>
  5. <title></title>
  6. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  7. <script type="text/javascript" src="swfobject.js"></script>
  8. <script type="text/javascript">
  9. var flashvars = {};
  10. var params = {};
  11. params.allowfullscreen = "true";
  12. var attributes = {};
  13. swfobject.embedSWF("untitled.swf", "myAlternativeContent", "800", "600", "9.0.0", false, flashvars, params, attributes);
  14. </script>
  15. </head>
  16. <body>
  17. <div id="myAlternativeContent">
  18. <a href="http://www.adobe.com/go/getflashplayer">
  19. <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />
  20. </a>
  21. </div>
  22. </body>
  23. </html>
  24.  
  25. //AC3:
  26. import flash.display.StageDisplayState;
  27.  
  28. function goFullScreen():void{
  29. if (stage.displayState == StageDisplayState.NORMAL){
  30. stage.displayState=StageDisplayState.FULL_SCREEN;
  31. }
  32. else {
  33. stage.displayState=StageDisplayState.NORMAL;
  34. }
  35. }
  36.  
  37. stage.addEventListener(MouseEvent.CLICK, _handleClick)
  38.  
  39. function _handleClick(event:MouseEvent):void{
  40. goFullScreen();
  41. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.