Return to Snippet

Revision: 31392
at September 4, 2010 01:12 by ichnoweb


Initial Code
/* Function in class */
prepareLabels: function(dataProperty,defaultEvent){
		var i = 0;
		$each(stageLabels,function(listElement){
			listElement.setProperty(dataProperty,i);
			listElement.addEvent(defaultEvent,function(e){
			    /* changeImage => other function in class */	 
                            this.changeImage(e.target);
			}.bind(this));  /* bind -> sets function-context */
			i++;
		},this);
	}

Initial URL

                                

Initial Description
requires mootools

Initial Title
Closure when using event handler

Initial Tags

                                

Initial Language
JavaScript