Monday 11 January 2010

AudioBook Organiser v1.3.0 - Drag'n'Drop



Well I was just doing some audio book organising and realised that it would be great if I could drag and drop a folder straight from my AIR into iTunes ready for upload to my iPhone.

Anyways after a little searching through the docs I came up with this little ditty:
var cp : Clipboard = new Clipboard();
cp.setData(ClipboardFormats.FILE_LIST_FORMAT, [new File(book.url)], false);
NativeDragManager.doDrag(null,cp);

Which gets fired by my DataGrid in the view:


<mx:DataGrid width="100%" height="100%" dataProvider="{books}" editable="true"

itemEditEnd="{dispatchEvent(new BooksEvent(BooksEvent.PROPERTY_CHANGED));}"

dragEnabled="true"

dragStart="{dispatchEvent(new BooksEvent(BooksEvent.BOOK_BEGIN_DRAG, AudioBookModel(event.currentTarget.selectedItem)))}">

Its pretty cool.

Anyways, the latest version and the source is below:



[airbadge]Audio Book Orgainser,http://www.mikecann.co.uk/flash/AudioBookOrganiser/AudioBookOrganiser.air,1,http://www.mikecann.co.uk/flash/AudioBookOrganiser/badgeImg.jpg[/airbadge]
Source: http://www.mikecann.co.uk/flash/AudioBookOrganiser/AudioBookOrganiser_v130_source.zip

1 comment:

  1. [...] execute native code (.dlls, .so, .jar etc) from Air. To me this was bloody brilliant as I had been playing with Air reccently and my day-job heavily involves Flex and I simply love the power and beauty of [...]

    ReplyDelete