var loader:URLLoader = new URLLoader();
// telling the loader that we are dealing with variables here.
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
// This is an eventlistener, these are used all the time in AS3
// learn to use them, this basically tells flash to listen to a specific event
// and then call a specific function.
// in Our case we listen for the even called COMPLETE which means it will active
// a function called "loading" when our flash movie has completed.
loader.addEventListener(Event.COMPLETE, loading);
// Here we tell our loading which file to extract from.
loader.load(new URLRequest("content.txt"));
// This is the function that will happen when the eventlistener activates.
// basiclly it says that our text fields called content_1 and _2's text property
// should be equal to loader.data.var_1 and var_2 (as you might remember from the explanation above).
function loading (event:Event):void {
content_1.text = loader.data.var_1
content_2.text = loader.data.var_2
}
content_1.text = loader.data.var_1
content_2.text = loader.data.var_2
}
0 comments:
Post a Comment