Storing Data Locally (FileStream) Problem

Hi,
I’m having a problem with a FileStream that I’ve created for a desktop widget. I need to save user settings in an XML file to retrieve later on.
It works when I test the movie in Flash, but when I package the app for AIR and install it on my system the methods below don’t create the file.

I’ve tried setting the directory to app:/ but my button doesn’t work when the AIR app is installed - yet it works when I test the movie and have the directory set to either app:/ or app-storage:/

I’ve tested the arrays separately and they’re all working fine, it just doesn’t create the file.

This is what I use to load the preference file (prefs.xml)…


readPreferences(); // Starts the whole process of loading preferences

function readPreferences():void {
	var fs:FileStream = new FileStream();
	fs.addEventListener( Event.COMPLETE, onOpenPreferences );
	fs.openAsync( new File( "app-storage:/prefs.xml" ), FileMode.READ );
}

// Assign preferences to an Array
function onOpenPreferences( event:Event ):void {
	var fs:FileStream = event.target as FileStream;
	var preferences:XML = XML( fs.readUTFBytes( fs.bytesAvailable ) );
	preferences.ignoreWhitespace=true;
	var USER:Namespace=preferences.namespace("USER");
	var noFeeds=preferences..USER::noFeed;
	for (var i:int=0; i < noFeeds.length(); ++i) {
		userPrefArray* = noFeeds*.attribute("noFeed");
	}
	loadXML(); // I call this method after the preferences have been assigned to an Array.
}


And I have this for actually saving the preferences via a button once they’ve been set in an Array called ‘userPrefArray’.


savePreferences_mc.savePreferences_btn.addEventListener( MouseEvent.CLICK, onSavePreferences );

function onSavePreferences( event:MouseEvent ):void {
	var fs:FileStream = new FileStream();
	fs.addEventListener( Event.COMPLETE, onFileStreamComplete );
	fs.openAsync( new File( "app-storage:/prefs.xml" ), FileMode.WRITE );
	var fileData:String = '<?xml version="1.0" encoding="utf-8"?>';
	fileData += "<USER:prefs xmlns:USER='http://www.raboplus.com.au/rsswidget/'>";
	for (var i:int=0; i<userPrefArray.length; i++){
		var prefString:String = userPrefArray*;
		fileData += '<USER:userSettings noFeed="'+ prefString + '" />';
	}
	fileData += "</USER:userSettings>";
	fileData += '</USER:prefs>';
	fs.writeUTFBytes( fileData );
	savePreferences_mc.prefStatus_txt.text = "Your preferences have been saved!";
}

function onFileStreamComplete( event:Event ):void {
	var fs:FileStream = event.target as FileStream;
	fs.close();
}


Any help would be greatly appreciated, once I’ve solved this problem my app is done!