Wouter Verweirder

My Personal Blog

Flash – HTML5 Drag and Drop Integration

After seeing Mario Klingemann’s HTML5 drag and drop demo, I wanted to write a library around it and make it a little more cross-browser.

Register the necessary event listeners to the class and react to events such as dragging a file / element over your swf, dropping data or dropping a file on the swf.

1
FlashDragDrop.addEventListener(FlashDragDropEvent.DROP_DATA, dropDataHandler);

You don’t need to add any extra javascript to your flash embed, the javascript necessary to add the drag and drop support is injected automatically.

You can detect the drag and drop events in the latest versions of Firefox, Safari and IE. Accessing the content of the dropped files only works in the latest version of Firefox (try dropping an image).

You can check out a demo or download the source files.

Comments