Downloadify: Client-Side File Generation Using Javascript and Flash

In: web resources

20 Jan 2010

The following tools is in its very beta stages and works intermittently. Its so damn useful that I had to show it off now though!

I recently stumbled upon Downloadify, a client-side file generation tool based on javascript and Flash ActionScript code. A huge advantage to creating files on the client-side is that you can reduce the load on the server — especially when there’s no need for the server to get involved (the data is available within the page, etc.) Lets take a look at how we can use Downloadify.

Downloadify Usage

Downloadify.create('downloader',{
  filename: function(){
    return 'secret-message.txt'; //static file -- you could retrieve from form input box
  },
  data: function(){
    return 'MooTools FTW!'; //static content -- you could retrieve from form input box
  },
  onComplete: function(){
    alert('The file has been saved!');
  },
  onCancel: function(){
    alert('You have cancelled the saving of this file.');
  },
  onError: function(){
    alert('Error!  Damn!');
  },
  transparent: false,
  swf: 'media/downloadify.swf',
  downloadImage: 'images/download.png',
  width: 210,
  height: 55,
  transparent: true,
  append: false
});

Downloadify provides numerous options which you may pass per instance within the create method — this should look familiar to notice to advanced javascript users. What I really love about Downloadify is that it provides just the right amount of customization — events and filename/content settings. Too many javascript classes/functions try to do too much; Downloadify gets it right. My only criticism of Downloadify is it’s requirement of a 4-state sprite; it would be great if that were an option or the ActionScript could detect the height setting vs. the image file’s actual height and use the sprite if available.

MooTools Helper

/* mootools helper */
if(typeof(MooTools) != 'undefined'){
	Element.implement({
		downloadify: function(options) {
			options = $extend(Downloadify.defaultOptions,options);
			return this.store('Downloadify',Downloadify.create(this,options));
		}
	});
}

Downloadify comes with a jQuery helper but not a MooTools helper…I’ve remedied this.

Downloadify fills a need for many developers. Avoid unnecessary server load and jump on Downloadify!

Don’t forget to follow me on Twitter and be sure to visit Script & Style for the best Javascript and CSS articles around!

Sponsor the David Walsh Blog and get your brand in front of several thousand users per day!

Downloadify: Client-Side File Generation Using Javascript and Flash

Related posts:

  1. Basic File Uploading Using PHP
  2. Facebook Sliders With Mootools and CSS – Now With Image Generation!
  3. Create a Zip File Using PHP
  4. Basic PHP File Handling — Create, Open, Read, Write, Append, Close, and Delete
  5. WordPress’ .htaccess File Is Genius


Go to Source

5 Responses to Downloadify: Client-Side File Generation Using Javascript and Flash

Avatar

KiwiJoey

January 31st, 2010 at 1:41 pm

An exponential function is a function in which the variable is in the exponent, for example a^kx where k is a constant.

A power function is a function in which the variable is the base, for example kx^b.

So 2^x would be an exponential function but x^2 would be an power function.

Avatar

latrailera2000

March 17th, 2010 at 12:36 am

OK, it depends on whether the CEO broke labor laws or not but if so you can file a complaint with your local or state labor agency. If he is merely breaking company policy you are outta luck.

Avatar

paul k

March 20th, 2010 at 10:21 am

relax its all good, especially if you are getting a refund, there are zero penalties for that. You only incur penalties when you owe. Sleep well

Avatar

nhawkl1

March 22nd, 2010 at 3:28 pm

It is a space character…..usually looks like this &nbsp?
It is a space character in HTML…web page code. It is harmless, its just a space but its showing up as &nbsp instead of the actual space.

Avatar

DMZ

March 27th, 2010 at 7:59 am

Comment Form

About this blog

This blog delivers stylish and dynamic news for designers and web-developers on all subjects of design, ranging from: CSS, Ajax, Javascript, web design, graphics, typography, advertising & much more. Our goal is to help you communicate effectively on the web with an engaging website or functional interface.