Tuesday, March 30, 2010

How can FMS create a text file and...

Recently, I writed a programe about creating a text file and writing data into it in the server application folder. My code is as following:

var fileObj = new File(''/MyApp/test.txt'');
if( fileObj !=?null)
{
?if(fileObj.open( ''text'', ''append''))
?{
?fileObj.write( ''?閳ユ柡鈧柡鈧柡鈧?Chat Info Backup 閳ユ柡鈧柡鈧柡鈧摶r\n'' );
?fileObj.close( );
?trace(''Chat info backup document :'' +?fileObj.name + '' has been created successfully!'');
?}
?}

But when I run it, FMS throw the error as following: File operation open failed?;?TypeError: fileObj has no properties.

Can you help me ? Thanks in advance.

Supplement: The text file named test.txt doesn't exist before create the fileObj, an instance of File Class.

How can FMS create a text file and...

Is MyApp the name of the application directory, or is it a child of the application directory? If myApp is the app name, just use test.txt as the path flag in the file constructor.

  • benzoyl peroxide
  • No comments:

    Post a Comment