This works with 2 external text files:

1. extern.txt:

Type some text in it, whatever you like.

2. The second example works with value-pairs in a txt file extern1.txt wich
looks like this:

datum=20 april 2004&stelling=Your text, etc.

// Don't put spaces between varname and =-sign


In Flash:

//AS30 in the first frame of your main timeline
var url:String;
var req:URLRequest = new URLRequest();
var ldr:URLLoader = new URLLoader();

ldr.addEventListener(Event.COMPLETE, ldrLoaded);
function ldrLoaded (e:Event):void {
        if(e.target.dataFormat == URLLoaderDataFormat.TEXT){
                updated_txt.text = "" ;
                stelling_txt.text = e.target.data;
        }else{
                updated_txt.text = e.target.data.datum ;
                stelling_txt.text = e.target.data.stelling ;
        }
}
stelling_btn.addEventListener(MouseEvent.CLICK, showStelling);
function showStelling (e:MouseEvent):void {
        ldr.dataFormat = URLLoaderDataFormat.TEXT;
        req.url= "extern.txt"
        ldr.load(req);
}

variabelen_btn.addEventListener(MouseEvent.CLICK, showVariabelen);
function showVariabelen (e:MouseEvent):void {
        ldr.dataFormat = URLLoaderDataFormat.VARIABLES;
        req.url= "extern1.txt"
        ldr.load(req);
}


Kind regards
Cor

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to