A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Curious about loading external txt files

  1. #1

    Curious about loading external txt files

    Im still learning actionscript but I'm curious why when i try to load external txt files into a movie clip this code works...

    loadVarsText = new loadVars();
    loadVarsText.load("updates.txt");
    loadVarsText.onLoad = function(success) {
    if (success) {
    trace("done loading");
    _root.news.nholder.text = this.var1;
    } else {
    trace("not loaded");
    }
    };

    and why this does not....

    loadVariables("updates.txt", _root.news.nholder.text);


    Anywho I'm just curious...
    Thanks,
    Inkdrop

  2. #2
    VIP Member
    Join Date
    Nov 2000
    Location
    United Kingdom
    Posts
    254
    does a few more lines really matter.

  3. #3
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    it should be...

    _root.news.nholder.text.loadVariables("updates.txt ");

    or.....

    loadVariables("updates.txt", "_root.news.nholder.text");

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  4. #4
    Junior Member
    Join Date
    Jan 2003
    Posts
    5
    It should work. But if you'll try to trace it right away after loading it won't work. You need to check for onData event.
    Like:


    Code:
    loadVariables("updates.txt", _root.news.nholder.text); 
    _root.news.nholder.onData=function(){
    // sometime that event occurs even before loading, 
    // so one more checking
      if(typeof(_root.news.nholder.text)!=undefined){
        trace(_root.news.nholder.text);
      }
    }
    that should work...

    Sergey

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