I'm trying to write to file, located in the root of my drive
(in this example - c:\). But string
var textFile = air.File.('file:///c:/MyTreeNotes.xml');
TypeError: Error #1034: Type Coercion failed: cannot convert
"file:///c:/MyTreeNotes.xml" to flash.filesystem.File.
I tried to write air.File('file://c:/MyTreeNotes.xml'),
air.File('c:\\MyTreeNotes.xml'), but i have got nothing, but
var textFile =
works fine. May be there are some security restrictions, or i
loose some small detail in file url?
var xml = 'some valid XML'
var textFile = air.File('file:///c:/MyTreeNotes.xml');
var textStream = new air.FileStream();
textStream.writeUTFBytes (BOM + '<?xml version="1.0"
encoding="utf-8"?>' + xml);
var textFile = new air.File('file:///c:/MyTreeNotes.xml');
If you want to use a fixed path you need to create new object
(using new keyword). Only when you want to access resources via
desktopDirectory-kind-of-properties you ommit the new keyword
(those properties are availble staticly).