A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Split var

  1. #1
    Member
    Join Date
    Mar 2003
    Location
    Netherland
    Posts
    33

    Split var

    Hello,
    i am try to make a KoolMoves chat.
    Now it's almost finish, but only one problem.
    I have 2 Dynamic text fields, one = txt1.text and two = txt2.text

    I wanna split one line (from the perl script), the text a user is get from a other user, and who's online (the names).
    So the perl script (see http://www.screensave.nl/get.pl)
    when you call it, it will show a line like this;

    i=text1;text2;text3&p=user1;user2;user3 etc..

    But how can i split the line, so that it first split the [ i ] text and value and after that the [ p ] the usernames in a other dynamic text field in just one update..
    I use the code below for the text update, and try a lot to change to make it posable to update text and users but till now no success, so i realy hope some one can help me.
    Thank you
    Hans

    update= function (){
    _root.loadVariables("http://www.screensave.nl/get.pl", "POST");
    records = i.split(';');
    for (var b = 0; b < records.length; b++){
    txt1.text=txt1.text+records[b]+'\n';
    }
    i = "";
    _root.txt1.text.scroll += 18;_level0.dwn = 1;
    }

    setInterval( update, 5000, );
    update();
    Last edited by hansverst; 11-14-2006 at 06:49 AM.

  2. #2
    up to my .as in code Chris_Seahorn's Avatar
    Join Date
    Dec 2004
    Posts
    4,389
    Code:
    update= function (){
    txt1.text="";
      var result_lv= new LoadVars();
        result_lv.onLoad = function(success) {
        if (success) {
        
        myusers = result_lv.p.split(';');
        for (var b=0; b < myusers.length; b++){
       txt1.text+= myusers[b]+'\n';
    }
        } else {
         //do something else   
        }};
        var send_lv = new LoadVars();
        send_lv.sendAndLoad("http://flashnow.servebbs.com/examples/split.txt", result_lv, "POST");   
    }
    
    setInterval( update, 5000, );
    update();
    I'm using a flat text file to emulate your cgi return but you get the idea
    http://flashnow.servebbs.com/examples/hansverst2.html

  3. #3
    Member
    Join Date
    Mar 2003
    Location
    Netherland
    Posts
    33

    Thank you Chris

    Hi Chris tnx for reply,
    And i get the idea, and works just fine now!
    i think it's working better now with 'sendAndLoad'
    Thank you for your help.
    Hans

  4. #4

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