I'm writing a graphic captcha test that uses dragged icons.  I'm
trying to store the draggable objects in an array that is a member of
my Captcha class.  However, the code fails to work, without error or
warning message, if I try and set the member array elements as I call
'new Draggable'.  If I use a local array the code works.  Here's the
working code:

var Captcha = Class.create({

  _click: function( event ) {
    this._icons.each( function( icon ) { icon.destroy(); } );  // free
  },  // end _click

  _Complete: function() {
    var icons = new Array();
    var options = { revert: true, constraint: 'horizontal' };
    $( 'captcha_refresh' ).observe( 'click',
this._click.bind( this ) );
    $$( '.draggable' ).each( function( el ) {
      icons.push( new Draggable( el.id, options ) );
    this._icons = icons.clone();
  },  // end _Complete

  _refresh: function() {
    var options = { onComplete: this._Complete.bind( this ) };
    new Ajax.Updater( 'captcha', this._url, options );
  },  // end _refresh

  initialize: function() {
    this._url = './captcha.php';  // url of the captcha script
    this._icons = new Array();
  }  // end initialize

});  // end of captcha

You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to