dcsimg
A Flash Developer Resource Site

Results 1 to 20 of 45

Thread: Embedding large text file

Threaded View

  1. #1
    Senior Member
    Join Date
    Jan 2008
    Location
    UK
    Posts
    269

    Embedding large text file

    Hey Chaps,

    I'm sure there's an easy solution to this, but I haven't figured it out yet!

    I have a very large text file (it's a 270,000 word list with one word per line) which I need to bring into my AS3 code. Importing it via url works just fine - loading it in as a string then converting to an array - no problems.

    However, I need to embed it into my code somehow so that there are no external files (for easy distribution). Using a search and replace tool, I've tried several things, none of which have worked including:

    Converting to a single space delimited string:

    Code:
    var wordList:String = "word1 word2 word3 ...";
    Result: crashes compiler.

    Code:
    Converting to an array: var wordList:Array = ["word1","word2","word3", ...];
    Result: crashes compiler too.

    The same tests work fine with much smaller sized word lists, but apparently the size of my word list is too large to work. I know flash can handle strings and arrays of this size, because as I said, it works fine when importing the text file via url. I just can't seem to get it to compile it when I embed it into code.

    Any ideas? Thanks
    Last edited by _Ric_; 04-01-2009 at 10:49 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center