13.08.2012 Views

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 33: Copy and paste<br />

Flash Player 10 and later, Adobe AIR 1.0 and later<br />

Use the classes in the clipboard API to copy information to and from the system clipboard. The data formats that can<br />

be transferred into or out of an application running in Adobe® Flash® Player or Adobe® AIR® include:<br />

Text<br />

HTML-formatted text<br />

Rich Text Format data<br />

Serialized objects<br />

Object refer<strong>en</strong>ces (valid only within the originating application)<br />

Bitmaps (AIR only)<br />

Files (AIR only)<br />

URL strings (AIR only)<br />

Basics of copy-and-paste<br />

Flash Player 10 and later, Adobe AIR 1.0 and later<br />

The copy-and-paste API contains the following classes.<br />

Package Classes<br />

flash.desktop Clipboard<br />

ClipboardFormats<br />

ClipboardTransferMode<br />

The static Clipboard.g<strong>en</strong>eralClipboard property repres<strong>en</strong>ts the operating system clipboard. The Clipboard class<br />

provides methods for reading and writing data to clipboard objects.<br />

The HTMLLoader class (in AIR) and the TextField class implem<strong>en</strong>t default behavior for the normal copy and paste<br />

keyboard shortcuts. To implem<strong>en</strong>t copy and paste shortcut behavior for custom compon<strong>en</strong>ts, you can list<strong>en</strong> for these<br />

keystrokes directly. You can also use native m<strong>en</strong>u commands along with key equival<strong>en</strong>ts to respond to the keystrokes<br />

indirectly.<br />

Differ<strong>en</strong>t repres<strong>en</strong>tations of the same information can be made available in a single Clipboard object to increase the<br />

ability of other applications to understand and use the data. For example, an image might be included as image data,<br />

a serialized Bitmap object, and as a file. R<strong>en</strong>dering of the data in a format can be deferred so that the format is not<br />

actually created until the data in that format is read.<br />

Last updated 6/6/2012<br />

595

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!