2 Replies Latest reply on Sep 3, 2010 9:29 AM by Ek24ambi

    Drag and Drop  from os on Windows 7

    Ek24ambi Level 1

      Since i ve search the forum and could not find a solution

      here is my problem :

       

      i m trying to enable drag and drop from the os the my AIR App (HTML + JS).

      How can i achieve that ?

       

      This sample code i got from here does not work :


      <html>

      <head>

      <title>Dragging an Image Into an Application</title>

      <script type="text/javascript" src="./lib/air/AIRAliases.js"></script>

      <script type="text/javascript">


      window.htmlLoader.addEventListener("nativeDragDrop",function(event){


      var filelist = event.clipboard.getData(air.ClipboardFormats.FILE_LIST_FORMAT);

      var elem = null;

      var name = null;


      for( var f = 0; f < filelist.length; f++ ) {

      name = filelist[f].name;

      elem = document.getElementById('list2');

      elem.innerHTML += name;

      }

      });


      function preventDefault(event) {


      alert('nino');

      event.preventDefault();

      }


      </script>

      </head>

      <body onDragEnter="preventDefault(event);" ondragover="preventDefault(event);">

      <div id="list2">hhhhhh</div>



      </body>

      </html>

       

       

      Please any help ?

       

      i really need this

       

      thx

       

      E