FLASH HELP

  • Started
  • Last post
  • 2 Responses
  • kbags

    Big deadline looming, please help!!!

    I have a .swf file that pulls news items from a .txt file (news.txt) in the same directory, but I can't get line breaks to register when Flash calls the file. It's all jumbled together...why???

    Here is the code:

    strRet = new Array();
    var myTxT = new LoadVars();
    myTxT.load("./flash/content/news...
    // loading the file ...

    --------------------------
    myStr = myTxT.toString();
    // myStr now contains the string of "news.txt"
    if (myStr.lastIndexOf("=") == myStr.length-1) {
    // if any eqal "=" caracter than cut it out
    myStr = myStr.substr(0, myStr.length-1);
    }
    strRet = myStr.split("%0A");
    // split to single lines and get rid of carriage return + line feed
    // note: split returns an array
    for (i=0; i

  • unfittoprint0

    A rare technote: you'll have to see if the server uses Linux or Windows, the method to parse line breaks are different...

    ie:

    myVars = new LoadVars();
    myVars.onLoad = function(sucess) {
    if (sucess) {
    textLines = String(this.ver).split("\r\n");
    // Linux servers [only '\n' works]
    if (textLines.length == 1) {
    textLines = String(this.var).split("\n");
    }
    } else {
    trace("ooops!");
    }
    };

    myVars.load("myVars.txt");

  • kbags0

    Yep, that did it!

    Muchas gracias...you're the man!