A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Loading text files: not good...

  1. #1
    Junior Member
    Join Date
    Nov 2003
    Location
    Portugal
    Posts
    29

    Loading text files: not good...

    Hi,

    This is not going well...I have a movie with a container and a variable connected to a dinamic text box (_root.containerMC.daTextBox).

    In each menu button, I have the code:

    Code:
    on (press)
    {
        System.useCodepage = true;
        /:textloaded="";
        _root.containerMC.daTextBox = "";
        btemp = Math.round(Math.random()*(1000000-1))+1;
        loadContent("text.txt?x="+btemp);
    }
    The function loadContent is:

    Code:
    function loadContent(url){
                     var lv=new LoadVars();
                     lv.onLoad=function(ok){
                          if(ok){
                               _root.containerMC.daTextBox = this.content_new;
                          }
                          else{
                               trace("vars failed to load");
                          }
                     }
                     lv.load(url);
                }
    Each text file has, this way, a variable "content_new" and a terminator "textloaded".

    The problem is that when I press a menu button, there's a fraction of a second where the Text Box becomes empty, but the second after it appears with the previous text (not the new) - nothing happens for about a minute; only then the new content appears.

    What am I doing wrong?

    Kind regards,

    rigel_kent
    Rigel_Kent

  2. #2
    Junior Member
    Join Date
    Jan 2006
    Posts
    4
    Hrrmm..so it takes about a minute for the text to load into the textbox?
    If that's the case (i just started learning flash) I would look for some kind of flush function or something...It shouldn't load the old text for a minute, and then load the new text...I would also reset the variables on every click before you load the new text so the old text doesn't show up.

  3. #3
    Junior Member
    Join Date
    Nov 2003
    Location
    Portugal
    Posts
    29
    Hi,

    I can I reset the variables (for instance daTextBox)?

    Regards,

    rigel_kent
    Rigel_Kent

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