When you do onComplete: this.fn.bind(this, args); You are creating a function and attaching it to the onComplete event of your effect. That function has those arguments bound to it, and every time the effect ends it will execute that function. If you then do:
onComplete: this.fn.bind(this, otherArgs) You are attaching *another* such function, with different args. Now, every time the effect completes, it will execute the first function (with args) and the second one (with otherArgs). You are creating and attaching multiple such functions. Consider either using chain (which only executes the function you attach once) or a method that retrieves the state from variables attached to the class or somewhere else. aaron On Sun, Aug 2, 2009 at 5:04 AM, Alexander <[email protected]> wrote: > > Howdy! > > I have a weird problem and I can't find the error. > I implemented some methods to the Hash class to act like a connected > list, means that I can ask the Hash about an element and it can return > its successor or predecessor. That works. > Now I have this hash filled with elements (that are classes). I take > the first from the hash and execute a method (morph) on the element > giving 2 parameters, both numeric. The element then runs a Fx.Morph > and in the onComplete declaration (onComplete: this.myFunc.bind(this, > [param1, param2])) I call another method within the element, > 'morphNext', giving the 2 parameters. morphNext asks the list for its > successor element and executes morph on it with the parameters. So > basically I do a morph on x elements and whenever a morph is finished > I morph on the next element. There a constraints so it does not morph > endless, the call chain is aborted somewhen. > My problem now refers to the 2 parameters. On the first morphing chain > call (by taking an element from the list and calling 'morph') I give > in 11 and 9, morphNext receives both numbers, calls the next elements > and than the chain is somewhen stopped. If I take another element from > the list after the first execution and call with parameters 10, 8 the > first call of morph receveives them correctly but then the morphNext > method that is called from the onComplete of the Fx.Morph has still > the old values 11 and 9 and not 10 and 8. I guess it has something to > do with the binding although I don't know what.... Maybe someone can > give me a hint here? Thanks a lot! > > Alex >
