SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    Pragmatic Programmer halfasleeps's Avatar
    Join Date
    Feb 2006
    Location
    Altoona, PA. USA
    Posts
    1,945
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    make height=100% but no less than 650?

    is there a way i can make a function to make an flash files height 100% if document height is over 650 and make it 650 if document height under 650?? and make it recall the function everytime the page is resized?

    this is how i am attaching the flash file if it is relavent to what needs to be done:

    Code:
    <script>
    var alter = "";
    var vars = "colorA=<?=$color1?>&colorB=<?=$color2?>";
    var movie = 'altoona';
    var width = '750';
    var height = '100%';
    var wmode = 'transparent';
    </script>
    <script src="loadFlashLinker.js"></script>
    <script language="JavaScript">
    	showFlash();
    </script>
    contents of loadFlashLinker.js:

    Code:
    function showFlash(){
    	var hasRightVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
    	if(hasRightVersion) {  // if we've detected an acceptable version
    		var isMSIE = navigator.appName.indexOf("Microsoft") != -1;
    		var l1 = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" width="'+width+'" height="'+height+'" id="flashapp" align="middle">';
    		var l1a = '<param name="wmode" value="'+wmode+'" />';
    		var l2 = '<param name="movie" value="'+movie+'.swf" />';
    		var l3 = '<param name="menu" value="false" />';
    		var l4 = '<param name="quality" value="best" />';
    		var l5 = '<param name="FlashVars" value="initialURL='+document.location+'&isMSIE='+isMSIE+'&'+vars+'" />';
    		var l6 = '<embed src="'+movie+'.swf" FlashVars="initialURL='+document.location+'&isMSIE='+isMSIE+'&'+vars+'" menu="false" quality="best" wmode="'+wmode+'" width="'+width+'" height="'+height+'" name="flashapp" align="middle" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed></object>';
    		document.write(l1+l1a+l2+l3+l4+l5+l6);
    	} else {  // flash is too old or we can't detect the plugin
       		window.open(alter, "_self");
      	}
    }

    THANKS!!
    Altoona Design
    Freelance Flex developer for hire.
    ActionScript Programmer with 8 Years Experience.

  2. #2
    Pragmatic Programmer halfasleeps's Avatar
    Join Date
    Feb 2006
    Location
    Altoona, PA. USA
    Posts
    1,945
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    this seems to do the trick
    Code:
    window.onresize = function () {
    	//alert('resized');
    	flash = document.getElementById('flashapp');
    	if(getDocSize('h')<650){
    		flash.style.height = '650';
    	}else{
    		flash.style.height = '100%';
    	}
    }
    function getDocSize(who) {
      var myHeight = 0;
      if( typeof( window.innerWidth ) == 'number' ) {
        //Non-IE
        myWidth = window.innerWidth;
        myHeight = window.innerHeight;
      } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
        //IE 6+ in 'standards compliant mode'
        myWidth = document.documentElement.clientWidth;
        myHeight = document.documentElement.clientHeight;
      } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
        //IE 4 compatible
        myWidth = document.body.clientWidth;
        myHeight = document.body.clientHeight;
      }
      if(who == 'h' ||  who == 'height'){
      	return myHeight;
      }else if(who == 'w' ||  who == 'width'){
      	return myWidth;
      }
    }
    thanks
    Altoona Design
    Freelance Flex developer for hire.
    ActionScript Programmer with 8 Years Experience.


Bookmarks

Posting Permissions

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