I am noob to Flex, so I maybe wrong. If you have a package created for the project and have good directory structure, you don't really need absolute path Say your two folders are: C://FlexApps/testconfig/src/assets/datafiles/untitled.txt C://FlexApps/testconfig/src/com/packagename/components/textreader.mxml
Here, if you are editing textreader.mxml and want to access untitled.txt, you can backtrack it. Legend: " ../ " <- takes u one directory down " / " <- takes u one directory up from textreader.mxml to untitled.txt now : C://FlexApps/testconfig/src/com/packagename/components/ ../ : C://FlexApps/testconfig/src/com/packagename/ ../ : C://FlexApps/testconfig/src/com/ ../ : C://FlexApps/testconfig/src/ assets/ : C://FlexApps/testconfig/src/assets/ datafiles/ : C://FlexApps/testconfig/src/assets/datafiles/ untitled.txt : C://FlexApps/testconfig/src/assets/datafiles/untitled.txt Summing it up from C://FlexApps/testconfig/src/com/packagename/components/textreader.mxml to C://FlexApps/testconfig/src/assets/datafiles/untitled.txt path: "../../../assets/datafiles/untitled.txt" - try this. Place an image with your txt file and insert it in ur mxml using Flex Development perspective. It should generate the relative path for you. -- Aviral Sharma Web: http://aviralsharma.com On Mon, Jan 25, 2010 at 18:28, Developer <[email protected]> wrote: > 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]<flex_india%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/flex_india?hl=en. > > -- 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.

