Flashscript classes (ActionScript 3) | Home | MX | MX 2004 | Flash 8 | Flash 9 |Flash 10 |PHP |Components | Snippets | Contact |

TextLoader

Package:
Class:
Inheritance:
biz.flashscript.utils
public class TextLoader
N/A
The TextLoader class allows to load text and XML files. Use the constructor new TextLoader() to create an instance of the class and add parameters as desired.
Public Methods
Method Defined By
TextLoader(textFile:String, loadParse:Function, myCache:Boolean=false, aNum:Object=null, bStr:Object=null, cBool:Object=null) TextLoader
Constructor Detail
TextLoader ()  Constructor
public function TextLoader(textFile:String, loadParse:Function, myCache:Boolean=false, aNum:Object=null, bStr:Object=null, cBool:Object=null)
Intializes a new TextLoader instance with the specified parameters.

Parameters

  • textFile:String ____ Specifies the URL for a text- or XML file.
  • loadParse:Function ____ The listener function, when the loading is completed.
  • myCache:Boolean=null ____ If true will add something to the url of the textfiel to prevent caching.
  • aNum:Object=null ____ Optional: A parameter to transfer to the listener function.
  • bStr:Object=null ____ Optional: A parameter to transfer to the listener function.
  • cBool:Object=null ____ Optional: A parameter to transfer to the listener function.
Examples
Create a new fla file and name it Textloader.fla. Place the fla in the same folder as the biz folder. Add a TextField and name it myText. In the same folder have a file named "textexample.txt" with text containing html tags. Then create an Actionscript file, name it Textloader.as and place this script.
package 
{
	import flash.display.Sprite;
	import biz.flashscript.utils.TextLoader;
	import flash.events.Event;

	public class Textloader extends Sprite
	{
		public function Textloader ():void
		{
			var mt:TextLoader = new TextLoader();
			mt.initText ("textexample.txt",completeHandler);
		}
		private function completeHandler (e:Event,a:String,b:Number,c:Boolean):void
		{
			trace (a+"  "+b+"  "+c);
			trace (e.currentTarget);
			myText.htmlText = e.currentTarget.data;
		}
	}
}