mojombo / clippy

Clippy is a very simple Flash widget that makes it possible to place arbitrary text onto the client's clipboard.
MIT License
938 stars 168 forks source link

Clippy text can only be set at initialization time #2

Open natacado opened 15 years ago

natacado commented 15 years ago

I'd like to use something like jQuery to update the flashVars attribute of clippy, so it clips different things at runtime. A workaround is to destroy and re-create clippy entirely, but it seems like it'd be possible to make clippy just read from the flashvars as the user clicks?

theworkinggroup commented 14 years ago

+1 for this one. It's wasteful to initialize a bunch of clippies. As a matter of fact I just crashed Firefox by loading like 100 of them.

ericabouaf commented 14 years ago

+ 1 , would be cool to have an javascript way to change the text

harking commented 13 years ago

Work around until the flash source can be recompiled is to just remove and recreate the flash object.

    function updateBcpClippy( text ) {
      $('#bcp-clippy').remove();
      var clippy = $('<object id="bcp-clippy" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"'+
                 'width="110"'+
                 'height="14"'+
                 'id="clippy" >'+
            '<param name="movie" value="/swf/clippy/build/clippy.swf"/>'+
            '<param name="allowScriptAccess" value="always" />'+
            '<param name="quality" value="high" />'+
            '<param name="scale" value="noscale" />'+
            '<param NAME="FlashVars" value="text='+text+'">'+
            '<param name="bgcolor" value="#fff">'+
            '<embed src="/swf/clippy/build/clippy.swf"'+
                   'width="110"'+
                   'height="14"'+
                   'name="clippy"'+
                   'quality="high"'+
                   'allowScriptAccess="always"'+
                   'type="application/x-shockwave-swf/clippy/build"'+
                   'pluginspage="http://www.macromedia.com/go/getswf/clippy/buildplayer"'+
                   'FlashVars="text='+text+'"'+
                   'bgcolor="#fff"'+
           '/>'+
           '</object>');
      $(bcp_textarea).after( clippy );
    }