Daniel Dura

All About the Adobe Flash Platform

Archive for June, 2007

New AIR Pocketguide from O’Reilly on Amazon

with 2 comments

The new AIR Pocketguide for JavaScript Developers that Mike Chambers, Kevin Hoyt, and I wrote is now available on Amazon. For some reason the cover isn’t shown on Amazon but I have attached it here. This book is in the same format as the Apollo for Adobe Flex Developers Pocket Guide that we released during the beta but focuses on developing AIR applications using JavaScript.

Amazon will not be the only way you can get your hands on the book. We will be making a PDF of the book available and you can also get a free printed copy by attending one of the free onAIR Bus Tour events around the country. Also, the contents of the book are released under a Creative Commons license.

Written by Daniel Dura

June 26th, 2007 at 1:32 pm

Posted in Adobe,AIR,Ajax

TwitterCamp Update

without comments

Today I updated TwitterCamp to use the AIR (formerly Apollo) Beta. You can download the new AIR package from the above link as well as see the updated source code. Hopefully by the time the bus tour starts I will have the code for TwitterCamp available on Google Code. This should allow you to keep up with any updates that are made via the Subversion repository. Let me know about any issues that you have installing or if you have any feature requests.

Written by Daniel Dura

June 18th, 2007 at 12:36 pm

Posted in AIR

Apollo Beta Sneak Peak: Drag and Drop

with 5 comments

Over the past few weeks I have been on the road in Tokyo, London, and now Paris. I am actually writing this post as I travel underneath the English Channel on the train! In Tokyo, Mike Chambers and I presented at the Apollo Camp there. My presentation was a sneak peak of some of the beta functionality that will be released in the Apollo Public Beta. The beta should be out in early summer (hmmm, isn’t it summer already?) Until that day comes, I am going to share some of what I have been presenting while on the road and give you a sneak peak of some of the new functionality that will be in this release.

One of the most exciting features in the Apollo Beta is Drag and Drop support. This is full OS level drag and drop support. You will be able to drag files, images, urls, text, serialized ActionScript objects, and other types to and from your Apollo application and other non Apollo applications and the desktop. You can control the image that is dragged and the modifiers that are allowed (copy, link, move, etc.) The first example I am going to share with you is how to start a drag operation from your Apollo application.

In this example, we are going to initiate a drag whenever a user clicks on a Button. We will use a snapshot of the button as the drag proxy (the image you see during the drag operation.) We will be transferring a URL with the drag which will allow us to drop this on browsers, text editors, and any other application that accepts URL types.

First you prepare the data that you are going to share with the drag and drop operation. To do this, you use an instance of the TransferableData class. This class allows you to add multiple data entries that are transfered with the drag operation by using the addData method. So for example, if I am dragging a URL, I might want to put both a URL format and a text format on the TransferableData object. The receiving application can then decide which data format is most appropriate.

var transfer:TransferableData = new TransferableData();
transfer.addData( “http://www.danieldura.com”, TransferableFormats.URL_FORMAT );
transfer.addData( “Daniel Dura’s Weblog”, TransferableFormats.TEXT_FORMAT );

Next, we want to specify a custom image that will be dragged with the image and will represent our data. For this example, we will just take a snapshot of the button that the user is clicking on and use that as our drag proxy. The drag and drop API takes a BitmapData object for this purpose.

var dragImage:BitmapData = new BitmapData( dragButton.width, dragButton.height, true );
dragImage.draw( dragButton );

Last, we initiate the drag by calling the DragManager.doDrag method. This method takes three arguments: the initiating display object, the TransferableData instance, and the BitmapData instance for the drag image.

DragManager.doDrag( dragButton, transfer, dragImage );

Here is the full example:


import flash.desktop.ClipboardManager;
import flash.desktop.TransferableFormats;
import flash.desktop.TransferableData;
import flash.desktop.DragManager;

private function handle_imageClick():void
var transferFormat:TransferableData = new TransferableData();
transferFormat.addData( "http://www.danieldura.com",
TransferableFormats.URL_FORMAT );

var dragImage:BitmapData = new BitmapData( dragButton.width,
dragButton.height, true );
dragImage.draw( dragButton );

DragManager.doDrag( dragButton, transferFormat, dragImage );


x="10" y="10"/>


So, this is just a very small taste of the funtionality available in the drag and drop API. In my next post, I will show how you can accept drops from other applications.

Written by Daniel Dura

June 8th, 2007 at 1:29 pm

Posted in AIR