I've found solution, i made so: when I launch my application I create my new 
folder automatically and when I want to use copyTo function my folder exists 
already. And when I create folders I check exist this folder or not, but I've a 
new problem: I have a DataGrid component with content which I get from my 
folder. My content consist a pictures. First, when my app is run i checking my 
folders content's and create Datagrid. Each item of Datagrid has some icon, 
picture's name and delete button. I added Listener for each item and when I 
press delete button I must delete this picture from folder and delete this item 
from my datagrid. I use this code:

dg.addEventListener("itemDelete", onItemDelete); // dg is my DataGrid's id
private function onItemDelete(e:Event):void{
            var r:libItem = e.target as components.libItem; // libItem is my 
custom component
            var targetIndex:int = dg.itemRendererToIndex(r);
            var dp:ArrayCollection = dg.dataProvider as ArrayCollection;
            var file:File = new 
File(_this._IMGDIR).resolvePath(nodes[targetIndex].name); 
            /* _this - path on root
                    _IMGDIR - root's public variable, which consist path on my 
folder
                    nodes - my array, which consist picture's name
                */
            file.deleteFileAsync(); // delete file from folder
            dp.removeItemAt(targetIndex); // remove item from dataGrid
}

This code working sometimes. When I remove some childs I get error:
File or directory doesn't exist




----- Original Message ----
From: Gordon Smith <[EMAIL PROTECTED]>
To: [email protected]
Sent: Wednesday, May 7, 2008 3:03:58 AM
Subject: RE: [flexcoders] addEventListener() for File.createDirectory(). How to 
use?


I think createDirectory( ) is synchronous.
If it was asynchronous, it would be named createDirectoryAsyn c().
 
Gordon Smith
Adobe Flex SDK Team
 

________________________________
 
From:[EMAIL PROTECTED] ups.com [mailto:flexcoders@ yahoogroups. com] On Behalf 
Of Carlo Gulliani
Sent: Monday, May 05, 2008 10:35
AM
To: [EMAIL PROTECTED] ups.com
Subject: Re: [flexcoders]
addEventListener( ) for File.createDirector y(). How to use?
 
Nobody know how create
eventListener for File.createDirector y() ???
----- Original Message
----
From: Carlo Gulliani <carlogulliani@ yahoo.com>
To: Flexcoders <[EMAIL PROTECTED] ups.com>
Sent: Monday, May 5, 2008 4:53:11 PM
Subject: [flexcoders] addEventListener( ) for File.createDirector y().
How to use?
Hello, everybody!

How to use addEventListener for File.createDirector y() on Adobe AIR?

I write code:

var dir:File = new File("e:\\") .resolvePath( "myDir");
dir.createDirectory ();
dir.addEventListene r(Event.COMPLETE , someFunc); // Tooltip show me that this
event i can use for my parameter and I want to check if my new Directory
created then call someFunc()
function someFunc(event: Event):void{
    var file:File = File.desktopDirecto re.resolvePath(
"test.jpg" );
    var newFile:File = dir.resolvePath( file.name) ;
    file.copyTo( newFile, true);
}

but this code doesn't work. my someFunc doesn't execute. I see, my folder
creating with some pause, I get new folder after 2-3 seconds after execute
function and I want to check when my folder is created and after it copy to it
some files 
 

________________________________
 
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. 
 

________________________________
 
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try
it now.    


      
____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

Reply via email to