4

Error: Error #2037: Functions called in incorrect sequence, or earlier call was...

 3 years ago
source link: http://www.mikechambers.com/blog/2009/02/28/error-error-2037-functions-called-in-incorrect-sequence-or-earlier-call-was-unsuccessful/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Error: Error #2037: Functions called in incorrect sequence, or earlier call was unsuccessful

Saturday, February 28, 2009

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]</code>

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.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK