Posted By

arpit on 06/29/09


Tagged

flash


Versions (?)


Advertising

Website Promotion DIRECTORY is a crucial factor for all websites that need to gain better organic search engine rankings and increase website traffic.
Submitting your website as part of your Web Promotion strategy to our SEO friendly and high traffic Business Directory for review is an excellent way to gain a valuable backlink and increase your websites visibility online.

Submit Site


Javascript window sizing for swf


Published in: JavaScript 






URL: http://www.thetechlabs.com/tutorials/flash/swfobject-and-best-practice-implementation/

Expand | Embed | Plain Text
  1. function setFlashSize(flashWidth,flashHeight){
  2. var size = [0,0];
  3. if( typeof( window.innerWidth ) == 'number' ) {
  4. size = [window.innerWidth, window.innerHeight];
  5. } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
  6. size = [document.documentElement.clientWidth, document.documentElement.clientHeight];
  7. } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
  8. size = [document.body.clientWidth, document.body.clientHeight];
  9. }
  10. window.onresize = function() {
  11. document.getElementById("flashContainer").style.minWidth = flashWidth+"px";
  12. document.getElementById("flashContainer").style.minHeight = flashHeight+"px";
  13. document.getElementById("flashContainer").style.width = size[0] < flashWidth ? flashWidth+"px" : "100%";
  14. document.getElementById("flashContainer").style.height = size[1] < flashHeight ? flashHeight+"px" : "100%";
  15. };
  16. window.onload = function(){
  17. window.onresize();
  18. }
  19. }
  20. SWFObject.embedSWF("example.swf", "flashMovie", "100%", "100%", "6.0.0","expressInstall.swf");
  21. setFlashSize(600,400);

Report this snippet 

You need to login to post a comment.

Download royalty free graphics