1 Reply Latest reply on Oct 16, 2008 10:59 PM by anirudhs

    File API system

    smokingguns Level 1
      hey all,
      I need your help regarding the syntax for the addEventListener() method.
      This is what I basically want to do:

      Obj = air.File.documentsDirectory;
      Obj.addEventListener( air.Event.SELECT, doDSelect(x,y) );



      For some reason this code doesnt work. Is it not possible to pass arguments to the doDselect function.
      How can I achieve this?

      Another issue was, when a user tries to move files from a hidden source directory to a destination directory.
      The 'moveToAsync(destination)' always returns I/O error in this case, but works fine when the source directory is a normal one.What gives??
        • 1. Re: File API system
          anirudhs Level 2
          Hi,

          addEventListener()'s second parameter is a function. You have to say addEventListener(air.Event.SELECT, doDSelect).

          If you say it as doDSelect(x,y) then what addEventListener sees is the return value of the function doDSelect (if that is a Function object, it will work).

          So if you want to pass arguments there use an anonymous function or make a global var that doDSelect can also see.