0 Replies - 952 Views - Last Post: 05 December 2006 - 12:32 AM

#1 pioSko  Icon User is offline

  • still.dreaming
  • member icon

Reputation: 23
  • View blog
  • Posts: 1,888
  • Joined: 06-June 03

Load External Text 2.0

Posted 05 December 2006 - 12:32 AM

Description: a) Create text file with following text: link=http://www.dreamincode.net b) In Flash, create a new scene and let it be the first scene. In this new scene add the code... with preloader.
stop();

var file:String = "yourfile.txt";

var textFile:LoadVars = new LoadVars();
textFile.onload = function(ok) {
    ok ? doTXT(this.link) : error();
};
textFile.load( file );

this.onEnterFrame = function(){
    var todo:Number = textFile.getBytesTotal();
    var done:Number = textFile.getBytesLoaded();
    
    if(todo == done){
        trace("TXT LOADED");
        delete this.onEnterFrame;
        play();
    } else {        
        if(todo){
            trace("TXT " + String(Math.round(100 / todo * done)) + "%");
        }
    }
}

function doTXT(link:String){
    trace(link);
}


Is This A Good Question/Topic? 0
  • +

Page 1 of 1