Reading Text File in ActionScript Moblie iOS App

I am trying to read from words from a text file in ActionScript Mobile Project. Each Word is then stored in an Array. This works fine during AIR IOS Simulator, but now I am Debugging on an Ipad and its not working...

Error #2044: Unhandled ioError:. text=Error #2032: Stream Error. URL: app:/var/mobile/Applications/13FB44C5-E2EB-421F-9EF8-CB1290B75DD8/Library/Application%20Support/com.mcmami3.word/Local%20Store/media/words5.txt

private function slangLoadedThree(event:Object):void {

        slangContentThree = event.target.data;
        slangArrayThree= slangContentThree.split("\n");

    }



//five letter load
            var xmlFileFive:File=new File(File.applicationStorageDirectory.nativePath).resolvePath("media/words5.txt");
            myLoaderThree.load(new URLRequest(xmlFileFive.nativePath));
            myLoader.addEventListener(AsyncErrorEvent.ASYNC_ERROR, errorHandlerAsyncErrorEvent);
            myLoader.addEventListener(IOErrorEvent.IO_ERROR, errorHandlerIOErrorEvent);
            myLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, errorHandlerSecurityErrorEvent);
            myLoaderThree.addEventListener(Event.COMPLETE, slangLoadedThree);

Answers


If there is only one file, you can just embed the txt file the same way you would embed an image. Directions on how found here:

Flex3: Load contents of an embedded text file into a variable

or here:

How do I embed static text in actionscript 3?


Try one of these:

myLoaderThree = new URLLoader();
myLoaderThree.addEventListener(Event.COMPLETE, processText, false, 0, true);
myLoaderThree.load(new URLRequest("media/words5.txt"));

or

var xmlFileFive:File = File.applicationStorageDirectory.resolvePath("media/words5.txt");
var _urlRequest:URLRequest = new URLRequest(f.url);
myLoader = new Loader();
myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, processText, false, 0, true);
myLoader.load(_urlRequest);

Both can use:

private function processText(e:Event):void {
        trace(e.target.data);
}

Need Your Help

Ruby Mail gem, how to script mail messages

ruby email smtp centos5

I have testmail.rb on a CENTOS 5 VM with SELinux permissive and IPtables off:

How to put information obtained by cast function of reshape package back in my original data frame in R

r casting reshape

I have a data.frame in panel format (country-year) and I need to calculate the mean of a variable by country and at each five years. So I just used the 'cast' function from 'reshape' package and it

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.