Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 3. Interacting with the Clipboar... > Understanding Clipboard Transfer Mod...

Understanding Clipboard Transfer Modes

When data is pasted from the clipboard, it can be pasted by value or by reference. You have probably run across the concepts of “pass by value versus pass by reference” in your previous programming experience, but in case you haven’t, it basically describes the two different ways that an object can be assigned to another place. In a “pass by value” situation, an independent copy of the item is made; any change to one of the copies has no impact whatsoever on the other. In a “pass by reference” situation, a new reference is made back to the original object, so that the same object is being referenced from more than one location. If there are any changes to the original, the changes are also made to the copy (since they are not independent, but simply pointers back to the same place). Likewise, when data is pasted from the clipboard, you have some control over whether the pasted data is a new copy or a reference to the original. This is determined by the ClipboardTranserMode. AIR has pre-defined constants that represent the built-in transfer modes that determine whether objects are references or copies.

  • ClipboardTransferModes.ORIGINAL_ONLY— Will only paste a reference. If the system is unable to paste a reference, it will paste a null value in its place.

  • ClipboardTransferModes.ORIGINAL_PREFERRED— Will attempt to paste a reference. If the system is unable to create a reference, it will paste a copy in its place.

  • ClipboardTransferModes.CLONE_ONLY— Will only paste a copy (passing by value). If the system is unable to paste a copy, it will paste a null value in its place.

  • ClipboardTransferModes.CLONE_PREFERRED— Will attempt to paste a copy. If the system is unable to create a copy, it will paste a reference in its place.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial