Error: Error #2037: Functions called in incorrect sequence, or earlier call was unsuccessful
I am doing some work on writing FlexUnit test cases for the FileMonitor class which I have added to as3corelib. Once I wrote the test, I got the following error, which didnt make a lot of sense to me at first:
[SWF] FileWatcher2.swf - 1,040,015 bytes after decompression
Error: Error #2037: Functions called in incorrect sequence, or earlier
call was unsuccessful.
at flash.filesystem::File/_exists()
at flash.filesystem::File/get exists()
at com.adobe.air.filesystem::FileMonitor/set file()[/Users/mesh/src/
as3corelib/src/com/adobe/air/filesystem/FileMonitor.as:138]
at com.adobe.air.filesystem::FileMonitor()[/Users/mesh/src/as3corelib/
src/com/adobe/air/filesystem/FileMonitor.as:94]
at FileWatcher2/onFileSelect()[/Users/mesh/Documents/Flex Builder 3/
FileWatcher2/src/FileWatcher2Class.as:32]
The error is thrown when trying to access a property of the File class (as well as FileReference) before the class has been initialized with a file path. Specifically, the File and FileReference classes must be initialized to reference a file path, before their properties can be accessed.
For example, this will cause the error:
var f:File = new File();
trace(f.exists());
This will not cause an error:
var f:File = File.desktopDirectory;
trace(f.exists());
Anyway, just wanted to post it here in case anyone else runs into the issue.






That would be:
var f:File = File.desktopDirectory;
trace(f.exists());
File.desktopDirectory is not a constructor but a static reference.
Isaac Rivera
28 Feb 09 at 7:07 am
@Isaac
Good catch. That will teach me to copy and past without testing first.
I fixed the error.
mike
mikechambers
2 Mar 09 at 12:49 am
AIR Error #2037: “Functions called in incorrect sequence, or earlier”…
After a short quiet period I’m back today to tell you something about the AIR file object. While deploying a new version of my application I ran into some problems on other systems. AIR threw the error #2037: “Functions called in incorrect sequence, …
The IT Kraut
1 Oct 09 at 2:18 am