1 Reply Latest reply: Aug 22, 2013 2:40 AM by Youtch RSS

    Error #3003 : can't remove a file into ApplicationStorageDirectory

    Youtch

      I have coded a process on image file wich is working with adl (FlashBuilder debugger) but it never works in emulator (an Android release APK), although I adapted it correctly, I think, from an AIR plateform version. The good thing is that I can pick an image to application into the two plateforms !

      Bad thing is I can't delete the file in applicationStorageDirectory on Android version.

      Two questions : In first, I'm not sure to have writing and removing file permission, I seems to be ok ?

      Secondly, did I use the right method to delete a file located into applicationStorageDirectory ?

       

      I can be In first I get the physical image to fileSystem with method :

      myImgFile.browseForOpen("title", [imagesFilter])

      on adl. Secondary I got physical image with all the specific events of CameraRoll class, and the

      myCameraRoll.browseForImage()

      interactive method on my Android packaging for testing version.

       

      protected function onAjouterFichierPhoto(event:CollectionEvent=null):void{
          var myImg:Image = new Image();
          myImg.source = event.currentTarget[0].nom; // Utilisation de acResultatFichierImg.nom
          var strImgSource:String = myImg.source.toString().substr(13);
          try{
              var myFile:File = File.applicationStorageDirectory.resolvePath(strImgSource1.substr(13));
              myFile.deleteFile();
              if(myFile.exists == false)
                  trace("Fichier supprimé du storageDirectory !");
          }
          catch(e:Error){
              trace("Photos->viewAjouterImage->Erreur #"+e.errorID+" : "+e.message+"\n");
          }
      }


      I received error #3003 "File or directory does not exist", does anybody know the reason of this wrong return ?

      NB : To be more precise, If I see the return of the variable strImgSource, I can see that : "storage:[photoName]" !