0 Replies Latest reply on Dec 2, 2012 5:15 PM by lancon

    HTML air.Clipboard.setData

    lancon

      Hi,

       

      I am working on a project require a file drag and drop between the desktop and the Adobe AIR App (which develop in HTML/Javascript).

       

      I spend a lot of time for "trial and error" which I eventually get it WORKS, since most documentation on the web are for Adobe AIR 1.5 that doesn't require a sandbox in order to access local file.

       

       

       

      However, just a quick question. When I create a event listener to listen for 'nativeDragStart' event in application sandbox

       

       

       

      window.htmlLoader.addEventListener('nativeDragStart', function(event)

      {

                        var file = air.File.createTempFile();

       

                         event.clipboard.clearData(air.ClipboardFormats.FILE_LIST_FORMAT);

                         event.clipboard.setData(air.ClipboardFormats.FILE_LIST_FORMAT,  [file]);

      }

       

      I keep getting error "TypeError: Data for file list format must be an array of Files..."

       

       

       

      After few hours search again, I found the correct way of doing event.clipboard.setData should be

       

                          event.clipboard.setData(air.ClipboardFormats.FILE_LIST_FORMAT,  new runtime.Array(file));

       

       

       

      What is the different between normal Array and runtime.Array in HTML/Javascript environemnt?

       

       

      It is very frustrated for this doesn't officially documented anywhere....

       

       

      Thanks!