Question

Is there a way to add an event listener to the copyTo() function so I can run code once the action is complete?

Below is my code and that last line is what I would assume might work, but it doesn't.

var sourceDir:File = File.applicationDirectory.resolvePath("userSettings.xml");
var resultDir:File = File.applicationStorageDirectory.resolvePath("userSettings.xml");
sourceDir.copyTo(resultDir, true);

// Is this possible?                
sourceDir.addEventListener(Event.COMPLETE, fileCopied);
Was it helpful?

Solution

According to DOCUMENTATION no, but copyToAsync() function is dispatching Event.COMPLETE.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top