O'Reilly logo

Adobe AIR 1.5 Cookbook by Koen De Weggheleire, Koen DeWeggheleire, Marco Casario, David Tucker, Rich Tretola

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 7. Clipboard Support

Because support for the clipboard is essential in any desktop application, AIR allows for access to the operating system clipboard in several data formats. AIR also provides support for many operations beyond the standard copying, cutting, and pasting of text within an application. The standard data formats within AIR let you work with many types of text data, bitmap data, and even file references. Another great feature of the clipboard support within AIR is that you can extend it and create your own custom clipboard data format to fit your AIR application.

Working with the Clipboard Data Types

Problem

You need to be able to see whether a specific type of data is present on the operating system clipboard.

Solution

Use the hasFormat method of the ClipboardFormats class to determine whether the desired format is defined by that class.

Discussion

The clipboard is designed to hold multiple types of data simultaneously. It is often prudent to store multiple formats of the same data when you store to the clipboard, because you may not know the preferred format of the application that may later use the clipboard data. AIR gives you the ability to work with the different data formats via many of the methods of the Clipboard class. To begin with, six default clipboard data formats are defined in AIR:

  • ClipboardFormats.TEXT_FORMAT: This format contains simple text data within the clipboard.

  • ClipboardFormats.HTML_FORMAT: This format contains formatted HTML data within the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required