Publish template for JavaScript solution

I’ve just finished a publish template for Flash to use with the “insertFlash” generic JavaScript solution for the upcoming IE changes. You can download the file here, simply drop it in the First Run/HTML folder of your Flash install directory and restart Flash.

You can then specify the “IE Changes Workaround” publish template in the publish settings dialog (File > Publish Settings). The exported HTML requires the file insertFlash.js to be located in the same directory for the JavaScript Flash embed to work.

There has also been an update to “insertFlash” itself, it now supports setting the required Flash player version and align property by specifying the “version” and “align” properties in the params argument.

insertFlash(“mySWF.swf”,550,400,”#FFFFFF”,{menu:false,version:”7,0,0,0″,align:”right”});

[Update] The “insertFlash” JavaScript code was just updated due to a problem with not specifying a value for the version attribute.

6 Comments

  • October 10, 2003 - 8:53 pm | Permalink

    Great contribution Peter.
    Thank you.
    Respectfully,
    aSH

  • October 30, 2003 - 5:53 pm | Permalink

    nice one!

    now, on to updating my sites… ;-)

  • November 12, 2003 - 1:34 am | Permalink

    excellent.. best solution so far :o)

  • December 14, 2003 - 3:09 pm | Permalink

    Here’s a suggested update to deal with flashvars and includes the color in the embed tag – I think this was missed..

    function insertFlash(swf,width,height,bgcolor,params,pairs) {
    // set default bgcolor if not provided
    if(!bgcolor || bgcolor==”") bgcolor = “#FFFFFF”;

    //parse pairs
    var flashvars=”";
    var writeAmp=false;
    for(var i in pairs){
    if (writeAmp){flashvars=flashvars+”&”;}else{writeAmp=true;}
    flashvars=flashvars+i+”=”+escape(pairs[i]);
    }

    if(!params) params = new Object();
    if(!params.version) params.version = “6,0,0,0″;
    if(!params.FlashVars) params.FlashVars=flashvars;

    // parse parameters
    var objectParams = “”;
    var embedParams = “”;
    for(var i in params) {
    objectParams += “\n”;
    embedParams += i+”=”+params[i];
    }

    // write the object
    document.write(“”);
    document.write(“”);
    document.write(“”);
    document.write(“”);
    document.write(objectParams);
    document.write(“”);
    document.write(“”);
    }

  • December 14, 2003 - 3:10 pm | Permalink

    er…the code in that post above didn’t come out quite right…

  • December 14, 2003 - 3:16 pm | Permalink

    Thanks for the suggestion Alex, the code came through alright, I’ll see what’s going wrong with it in the comments section.

    Ofcourse FlashVars could already be used by specifying them in the object that gets passed to the script as an object. Color in the embed tag is an ommision on my part, that will soon get fixed. Thanks for the feedback!

  • Comments are closed.

    .