setClipboard (System.setClipboard method)

public static setClipboard(text:String) : Void

Replaces the contents of the Clipboard with a specified text string.

Note: Because of security concerns, it is not possible to read the contents of the system Clipboard. In other words, there is no corresponding System.getClipboard() method.

Availability: ActionScript 1.0; Flash Player 7 - SWF files published for Flash Player 6 or later, playing in Flash Player 7 or later.

Parameters

text:String - A plain-text string of characters to place on the system Clipboard, replacing its current contents (if any).

Example

The following example places the phrase "Hello World" onto the system Clipboard:

System.setClipboard("Hello world");

The following example creates two text fields at runtime, called in_txt and out_txt. When you select text in the in_txt field, you can click the copy_btn to copy the data to the Clipboard. Then you can paste the text into the out_txt field.

this.createTextField("in_txt", this.getNextHighestDepth(), 10, 10, 160, 120);
in_txt.multiline = true;
in_txt.border = true;
in_txt.text = "lorum ipsum...";
this.createTextField("out_txt", this.getNextHighestDepth(), 10, 140, 160, 120);
out_txt.multiline = true;
out_txt.border = true;
out_txt.type = "input";

copy_btn.onRelease = function() {
    System.setClipboard(in_txt.text);
    Selection.setFocus("out_txt");
};

If your SWF file includes a version 2 component, use the version 2 components DepthManager class instead of the MovieClip.getNextHighestDepth() method, which is used in this example.


Flash CS3


 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/9.0/main/00002187.html