Can you not use options?

Effect.EffectRequiringIndex = Class.create();
Object.extend(Effect.EffectRequiringIndex.prototype, Effect.BlindUp.prototype, Effect.BlindDown.prototype, Effect.Base.prototype);
Object.extend(Effect.EffectRequiringIndex, {
    initialize: function(element, options) {
        Object.extend(new Effect.toggle.prototype(element, 'blind', Object.extend({
            index:0 /* or set this based on some counter? */
        },options||{})), this);
    },
    ....
    beforeSetup: function(effect) {
        effect.index = effect.options.index;
    },
    beforeStartInternal: function(effect) {
        effect.index = effect.options.index;
    }
};
var i=5;
new Effect.EffectRequiringIndex('elementid',{index:i});

Something like that maybe?  I haven't extended any Effects before but I've done something similar to that before with IPEs. Not sure if that is what you want or not though.
Depending on where you want to set i, you may not need to extend initialize.

Colin

Ian Tyndall wrote:
Since I haven't received any responses yet, I thought I would go into 
more detail.

Code that need this usage:

           afterFinish: function(e) {
             var pos = e.index + ':' + e.element;
            $('debug').innerHTML = pos;
           }

What I'm trying to do on the back end to provid this usage:

        var i = 5;
        Object.extend(Object.extend(Effect.BlindUp.prototype, 
Effect.BlindDown.prototype, Effect.Base.prototype), {
              beforeSetup: function(effect) {
            effect.index = i;
            },
              beforeStartInternal: function(effect) {
            effect.index = i;
                }
        });

I have tried various Object extend methods with no results. How do I go 
about finishing this puzzle?

  
I have a functiont that uses the Blind up and down effect. With this 
effect I am utilizing the effect.element through my option functions, 
but I would like to add effect.index to the effect object for use too!
I've tried various Object.extend techniques, but am getting no where!

Any thoughts or advice would greatly be appreciated!

Ian


    
 

    





  

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs
-~----------~----~----~----~------~----~------~--~---

Reply via email to