I have the following code which works correctly without any issues. All it does is read the testfile.txt from the client machine and print the data to textarea. It works when I am using the absolute path as shown. How can I use it so that I don't have to type C://FlexApps/testconfig/src/. I want to use relative path but something is wrong in my code line that is commented. Thx.
<?xml version="1.0" encoding="utf-8"?> <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" viewSourceURL="srcview/index.html" creationComplete="init()" height="1000"> <mx:Script> <![CDATA[ import mx.controls.Alert; import flash.filesystem.File; import flash.filesystem.FileMode; import flash.filesystem.FileStream; private function init(): void { var myFile:File = new File( "C://FlexApps/testconfig/src/config/ testfile.txt" ) // var myFile:File = new File( "file:./config/testfile.txt" ) var fs:FileStream = new FileStream(); fs.open ( myFile, FileMode.READ ) var str:String = fs.readMultiByte(myFile.size, File.systemCharset); var lineEndPattern:RegExp = new RegExp(File.lineEnding, "g"); str = str.replace(lineEndPattern, "\n"); fs.close(); testa.text = str; //Alert.show ( str ) } ]]> </mx:Script> <mx:TextArea id="testa" height="790" width="770" wordWrap="true"/> </mx:WindowedApplication> -- You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/flex_india?hl=en.

