JSFiddle - React, Tailwind, and code Playground

by snaptopixel

HTML

<script src="https://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
<script src="http://cloud.github.com/downloads/SteveSanderson/knockout/knockout-2.1.0.js"></script>
<button data-bind="click:function(){swfUrl('http://www.homestarrunner.com/sbemail205.swf')}">SWF 1</button>
<button data-bind="click:function(){swfUrl('http://www.homestarrunner.com/sbemail203.swf')}">SWF 2</button>
<button data-bind="click:function(){swfUrl('http://www.homestarrunner.com/sbemail204.swf')}">SWF 3</button>
<br/>
<div id="swf-goes-here" data-bind="flash:swfUrl"></div>

JavaScript

(function(){
    var id = 0;
    ko.bindingHandlers['flash'] = {
        'update': function(element, valueAccessor) {
            var swfid = element.id + "-swf";
            if( !document.getElementById(swfid) ) {
                var d = document.createElement('div');
                d.id = swfid;
                element.appendChild(d);
            }
            var value = ko.utils.unwrapObservable(valueAccessor());
            swfobject.embedSWF(value, swfid, "550", "400", "9.0.0");
        }
     };
})();

ko.applyBindings({
    swfUrl: ko.observable("http://www.homestarrunner.com/sbemail202.swf")
});