There's a trick to mention the URL of the file when the Data.txt file is not in the same folder as the main .mxml file. For example, if your file is in a folder called News, then the URLRequest should contain the location of the file like this:
"./News/Data.txt". Ofcourse, the News folder should be in the same domain. If you need to access a file in another domain, you will have to make a cross-domain file. This I will be discussing later.
The project structure should be like this for the below code to work:

This example shows a simple Data.txt file being read.


3 comments:
Good for people to know.
Hai,
I have a question about read.txt file.. I use './folder/bla.txt', when i 'Run #site' (Flex builder) it works just fine..
But when i 'Export Release Build' (Flex Builder) it didn't work anymore..
It just freeze when its load the txt file.. Do you maybe why it happens? en do you maybe have the solutions ?
Thank you!
try this it may help you-- it may be with security issues from accessing local file system. u can do -use-network=false in compiler arguments and another option is to deal with flash player Global security settings for more information about this global security settings plz try this link
http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html
Post a Comment