/*
---
description: Asset preloader for MooTools.

license: MIT-style

authors:
- Christopher Pitt

requires:
- core/1.2.4: CLass.Extras
- core/1.2.4: Element.Event
- core/1.2.4: Request

provides: [Preloader]

...
*/

var Preloader = new Class({
	'Implements': [Events],
	'initialize': function(file)
	{	
		var self = this;
		
		new Request({
			'url': file,
			'method': 'get',
			'onSuccess': function(text)
			{
				self.length = text.length;
				self.fireEvent('onSuccess', [text.length]);
			},
			'onFailure': function()
			{
				self.fireEvent('onFailure');
			}
		}).send();
	}
});