Permalink
Browse files

going with one src, for the future

  • Loading branch information...
jonrohan committed Jul 13, 2012
1 parent 4e3f9c0 commit 0ad95175f0cc92dcb10d4e5bb7108252f4980c61
View
@@ -3,7 +3,7 @@ Zero Clipboard
The Zero Clipboard library provides an easy way to copy text to the clipboard using an invisible [Adobe Flash](http://en.wikipedia.org/wiki/Adobe_Flash) movie, and a [JavaScript](http://en.wikipedia.org/wiki/JavaScript) interface. The "Zero" signifies that the library is invisible and the user interface is left entirely up to you.
-This library is fully compatible with Flash Player 10, which requires that the clipboard copy operation be initiated by a user click event inside the Flash movie. This is achieved by automatically floating the invisible movie on top of a [DOM](http://en.wikipedia.org/wiki/Document_Object_Model) element of your choice. Standard mouse events are even propagated out to your DOM element, so you can still have rollover and mouse down effects.
+This library is built for the latest Flash Player 11.2 and built in Adobe Flash Professional CS6 v.12, which requires that the clipboard copy operation be initiated by a user click event inside the Flash movie. This is achieved by automatically floating the invisible movie on top of a [DOM](http://en.wikipedia.org/wiki/Document_Object_Model) element of your choice. Standard mouse events are even propagated out to your DOM element, so you can still have rollover and mouse down effects.
See the [Instructions](https://github.com/jonrohan/ZeroClipboard/blob/master/docs/instructions.md) for instructions on how to use the library on your site.
View
BIN build/ZeroClipboard.swf 100755 → 100644
Binary file not shown.
View
Binary file not shown.
View
@@ -372,16 +372,4 @@ Here is a complete example which exercises every option and event handler:
</script>
</body>
</html>
-```
-
-## Browser Support
-
-The Zero Clipboard Library has been tested on the following browsers / platforms:
-
-|| *Browser* || *Windows XP SP3* || *Windows Vista* || *Mac OS X Leopard* ||
-|| Internet Exploder || 7.0 || 7.0 || - ||
-|| Firefox || 3.0 || 3.0 || 3.0 ||
-|| Safari || - || - || 3.0 ||
-|| Google Chrome || 1.0 || 1.0 || - ||
-
-Adobe Flash Flash Player versions 9 and 10 are supported.
+```
View
82 src/flash/ZeroClipboard.as 100755 → 100644
@@ -1,81 +1 @@
-package {
- // Simple Set Clipboard System
- // Author: Joseph Huckaby
-
- import flash.display.Stage;
- import flash.display.Sprite;
- import flash.display.LoaderInfo;
- import flash.display.StageScaleMode;
- import flash.events.*;
- import flash.display.StageAlign;
- import flash.display.StageScaleMode;
- import flash.external.ExternalInterface;
- import flash.system.Security;
- import flash.utils.*;
- import flash.system.System;
-
- public class ZeroClipboard extends Sprite {
-
- private var id:String = '';
- private var button:Sprite;
- private var clipText:String = '';
-
- public function ZeroClipboard() {
- // constructor, setup event listeners and external interfaces
- stage.scaleMode = StageScaleMode.EXACT_FIT;
- flash.system.Security.allowDomain("*");
-
- // import flashvars
- var flashvars:Object = LoaderInfo( this.root.loaderInfo ).parameters;
- id = flashvars.id;
- id = id.split("\\").join("\\\\");
- // invisible button covers entire stage
- button = new Sprite();
- button.buttonMode = true;
- button.useHandCursor = true;
- button.graphics.beginFill(0xCCFF00);
- button.graphics.drawRect(0, 0, Math.floor(flashvars.width), Math.floor(flashvars.height));
- button.alpha = 0.0;
- addChild(button);
- button.addEventListener(MouseEvent.CLICK, clickHandler);
-
- button.addEventListener(MouseEvent.MOUSE_OVER, function(event:Event) {
- ExternalInterface.call( 'ZeroClipboard.dispatch', id, 'mouseOver', null );
- } );
- button.addEventListener(MouseEvent.MOUSE_OUT, function(event:Event) {
- ExternalInterface.call( 'ZeroClipboard.dispatch', id, 'mouseOut', null );
- } );
- button.addEventListener(MouseEvent.MOUSE_DOWN, function(event:Event) {
- ExternalInterface.call( 'ZeroClipboard.dispatch', id, 'mouseDown', null );
- } );
- button.addEventListener(MouseEvent.MOUSE_UP, function(event:Event) {
- ExternalInterface.call( 'ZeroClipboard.dispatch', id, 'mouseUp', null );
- } );
-
- // external functions
- ExternalInterface.addCallback("setHandCursor", setHandCursor);
- ExternalInterface.addCallback("setText", setText);
-
- // signal to the browser that we are ready
- ExternalInterface.call( 'ZeroClipboard.dispatch', id, 'load', null );
- }
-
- public function setText(newText) {
- // set the maximum number of files allowed
- clipText = newText;
- }
-
- public function setHandCursor(enabled:Boolean) {
- // control whether the hand cursor is shown on rollover (true)
- // or the default arrow cursor (false)
- button.useHandCursor = enabled;
- }
-
- private function clickHandler(event:Event):void {
- // user click copies text to clipboard
- // as of flash player 10, this MUST happen from an in-movie flash click event
- System.setClipboard( clipText );
- ExternalInterface.call( 'ZeroClipboard.dispatch', id, 'complete', clipText );
- }
- }
-}
+package { // Simple Set Clipboard System // Author: Joseph Huckaby import flash.display.Stage; import flash.display.Sprite; import flash.desktop.Clipboard; import flash.desktop.ClipboardFormats; import flash.desktop.ClipboardTransferMode; import flash.display.LoaderInfo; import flash.display.StageScaleMode; import flash.events.*; import flash.display.StageAlign; import flash.display.StageScaleMode; import flash.external.ExternalInterface; import flash.system.Security; import flash.utils.*; import flash.system.System; public class ZeroClipboard extends Sprite { private var id:String = ''; private var button:Sprite; private var clipText:String = ''; public function ZeroClipboard() { // constructor, setup event listeners and external interfaces stage.scaleMode = StageScaleMode.EXACT_FIT; flash.system.Security.allowDomain("*"); // import flashvars var flashvars:Object = LoaderInfo( this.root.loaderInfo ).parameters; id = flashvars.id; // invisible button covers entire stage button = new Sprite(); button.buttonMode = true; button.useHandCursor = true; button.graphics.beginFill(0xCCFF00); button.graphics.drawRect(0, 0, Math.floor(flashvars.width), Math.floor(flashvars.height)); button.alpha = 0.0; addChild(button); button.addEventListener(MouseEvent.CLICK, clickHandler); button.addEventListener(MouseEvent.MOUSE_OVER, function(event:Event) { ExternalInterface.call( 'ZeroClipboard.dispatch', id, 'mouseOver', null ); } ); button.addEventListener(MouseEvent.MOUSE_OUT, function(event:Event) { ExternalInterface.call( 'ZeroClipboard.dispatch', id, 'mouseOut', null ); } ); button.addEventListener(MouseEvent.MOUSE_DOWN, function(event:Event) { ExternalInterface.call( 'ZeroClipboard.dispatch', id, 'mouseDown', null ); } ); button.addEventListener(MouseEvent.MOUSE_UP, function(event:Event) { ExternalInterface.call( 'ZeroClipboard.dispatch', id, 'mouseUp', null ); } ); // external functions ExternalInterface.addCallback("setHandCursor", setHandCursor); ExternalInterface.addCallback("setText", setText); // signal to the browser that we are ready ExternalInterface.call( 'ZeroClipboard.dispatch', id, 'load', null ); } public function setText(newText) { // set the maximum number of files allowed clipText = newText; } public function setHandCursor(enabled:Boolean) { // control whether the hand cursor is shown on rollover (true) // or the default arrow cursor (false) button.useHandCursor = enabled; } private function clickHandler(event:Event):void { // user click copies text to clipboard // as of flash player 10, this MUST happen from an in-movie flash click event Clipboard.generalClipboard.clear(); Clipboard.generalClipboard.setData(ClipboardFormats.TEXT_FORMAT, clipText); Clipboard.generalClipboard.setData(ClipboardFormats.HTML_FORMAT, clipText); ExternalInterface.call( 'ZeroClipboard.dispatch', id, 'complete', clipText ); } }}
View
BIN src/flash/ZeroClipboard.fla 100755 → 100644
Binary file not shown.
@@ -1 +0,0 @@
-package { // Simple Set Clipboard System // Author: Joseph Huckaby import flash.display.Stage; import flash.display.Sprite; import flash.desktop.Clipboard; import flash.desktop.ClipboardFormats; import flash.desktop.ClipboardTransferMode; import flash.display.LoaderInfo; import flash.display.StageScaleMode; import flash.events.*; import flash.display.StageAlign; import flash.display.StageScaleMode; import flash.external.ExternalInterface; import flash.system.Security; import flash.utils.*; import flash.system.System; public class ZeroClipboard10 extends Sprite { private var id:String = ''; private var button:Sprite; private var clipText:String = ''; public function ZeroClipboard10() { // constructor, setup event listeners and external interfaces stage.scaleMode = StageScaleMode.EXACT_FIT; flash.system.Security.allowDomain("*"); // import flashvars var flashvars:Object = LoaderInfo( this.root.loaderInfo ).parameters; id = flashvars.id; // invisible button covers entire stage button = new Sprite(); button.buttonMode = true; button.useHandCursor = true; button.graphics.beginFill(0xCCFF00); button.graphics.drawRect(0, 0, Math.floor(flashvars.width), Math.floor(flashvars.height)); button.alpha = 0.0; addChild(button); button.addEventListener(MouseEvent.CLICK, clickHandler); button.addEventListener(MouseEvent.MOUSE_OVER, function(event:Event) { ExternalInterface.call( 'ZeroClipboard.dispatch', id, 'mouseOver', null ); } ); button.addEventListener(MouseEvent.MOUSE_OUT, function(event:Event) { ExternalInterface.call( 'ZeroClipboard.dispatch', id, 'mouseOut', null ); } ); button.addEventListener(MouseEvent.MOUSE_DOWN, function(event:Event) { ExternalInterface.call( 'ZeroClipboard.dispatch', id, 'mouseDown', null ); } ); button.addEventListener(MouseEvent.MOUSE_UP, function(event:Event) { ExternalInterface.call( 'ZeroClipboard.dispatch', id, 'mouseUp', null ); } ); // external functions ExternalInterface.addCallback("setHandCursor", setHandCursor); ExternalInterface.addCallback("setText", setText); // signal to the browser that we are ready ExternalInterface.call( 'ZeroClipboard.dispatch', id, 'load', null ); } public function setText(newText) { // set the maximum number of files allowed clipText = newText; } public function setHandCursor(enabled:Boolean) { // control whether the hand cursor is shown on rollover (true) // or the default arrow cursor (false) button.useHandCursor = enabled; } private function clickHandler(event:Event):void { // user click copies text to clipboard // as of flash player 10, this MUST happen from an in-movie flash click event Clipboard.generalClipboard.clear(); Clipboard.generalClipboard.setData(ClipboardFormats.TEXT_FORMAT, clipText); Clipboard.generalClipboard.setData(ClipboardFormats.HTML_FORMAT, clipText); ExternalInterface.call( 'ZeroClipboard.dispatch', id, 'complete', clipText ); } }}
Binary file not shown.

0 comments on commit 0ad9517

Please sign in to comment.