A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: A Different twist on "FlashObject"

  1. #1
    Senior Member
    Join Date
    Jan 2001
    Posts
    191

    A Different twist on "FlashObject"

    Hey All. I thought I would contribute my little script that works pretty well for writing SWFs to a page and bypassing the new IE security patches. It's a lot simpler than FlashObject, so use it if you like:

    Code:
    // SWF Writer
    // Anti-Eolas Active Content Writer for Flash Content
    // (C) 2005 Nebulus Designs
    // All rights Reserved
    // www.nebulus.org
    
    // usage:
    // In the <HEAD>, include this script:
    // <script language="javascript" type="text/javascript" src="path/to/js/swfWriters.js"></script>
    //
    // In the <BODY>, call writeSWF with any number of parameters
    // <script language="javascript" type="text/javascript">
    // writeSWF('foo.swf',100,200,'myFlash','#ffffff','false','middle','Transparent','sameDomain','7,0,0,0','var1=val1&var2=val2');
    // </script>
    
    function writeSWF(mov,w,h,id,bg,mnu,aln,wm,axs,ver,fv){
    	// NOTE : All paths and flashvars must be escaped!
    	// mov  : url or path to the SWF
    	// w, h : width/height of the content
    	// id   : name of the object within the html document.
    	// bg   : background color of the content
    	// mnu  : menu display - true/false
    	// aln  : alignment
    	// axs  : script access: sameDomain, always, never
    	// ver  : version info. needs to be in the format: '6,0,0,0'
    	// fv   : FlashVars in url encoded name/value pairs.
    
    	ac  = '<object \n';
    	ac += 'classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" \n';
    	ac += 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + ver + '" \n';
    	ac += 'width="'  + w   + '" \n';
    	ac += 'height="' + h   + '" \n';
    	ac += 'id="'     + id  + '" \n';
    	ac += 'align="'  + aln + '">\n';
    	ac += '<param name="movie" value="' + mov + '" />\n';
    	if(fv != null){
    		ac += '<param name="FlashVars" value="' + fv + '" />\n';
    	}
    	ac += '<param name="allowScriptAccess" value="' + axs + '" />\n';
    	ac += '<param name="quality" value="high" />\n';
    	ac += '<param name="bgcolor" value="' + bg  + '" />\n';
    	if(wm != ''){
    		ac += '<param name="wmode" value="transparent" />\n';
    	}
    	ac += '<param name="menu" value="' + mnu + '" />\n';
    	ac += '<embed \n';
    	ac += 'src="' + mov + '" \n';
    	if(fv != null){
    		ac += 'FlashVars="' + fv + '" \n';
    	}
    	ac += 'quality="high" \n';
    	ac += 'bgcolor="'           + bg  + '" \n';
    	ac += 'width="'             + w   + '" \n';
    	ac += 'height="'            + h   + '" \n';
    	ac += 'name="'              + id  + '" \n';
    	ac += 'align="'             + aln + '" \n';
    	ac += 'menu="'              + mnu + '" \n';
    	ac += 'allowScriptAccess="' + axs + '" \n';
    	ac += 'type="application/x-shockwave-flash" \n';
    	ac += 'pluginspage="http://www.macromedia.com/go/getflashplayer" />\n';
    	ac += '</object>\n';
    	document.write(ac);
    }

  2. #2
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,488
    Macromedia has come out with an extension for Flash 8, to publish the pages with the script already in it.

    http://www.flashkit.com/board/showthread.php?t=684268

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