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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs -~----------~----~----~----~------~----~------~--~---
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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs -~----------~----~----~----~------~----~------~--~---
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; > }Does ''index'' need to be a property of ''e''? Can''t you just use a closure? var index = 5; ... afterFinish: function(e) { var pos = index + '':'' + e.element; $(''debug'').innerHTML = pos } -- Michael Peters Developer Plus Three, LP --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs -~----------~----~----~----~------~----~------~--~---
Michael, thanks for responding! I''m afraid that I need it to be a property of that object. What it boils down to is: I have an effect that uses two of the core effects. I have begun the implementation of allowing callbacks to the main core effects through the HTML page as options. Through these options (afterFinish, beforeStart), I would also allow use of the "e.index". So, I need to set this through my javascript function and update it as needed.> >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; >> } >> >> > >Does ''index'' need to be a property of ''e''? Can''t you just use a closure? > > var index = 5; > ... > afterFinish: function(e) { > var pos = index + '':'' + e.element; > $(''debug'').innerHTML = pos > } > > >--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs -~----------~----~----~----~------~----~------~--~---
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type"> </head> <body bgcolor="#ffffff" text="#000000"> Can you not use options? <br> <br> Effect.EffectRequiringIndex = Class.create();<br> Object.extend(Effect.EffectRequiringIndex.prototype, Effect.BlindUp.prototype, Effect.BlindDown.prototype, Effect.Base.prototype);<br> Object.extend(Effect.EffectRequiringIndex, {<br> initialize: function(element, options) {<br> Object.extend(new Effect.toggle.prototype(element, ''blind'', Object.extend({<br> index:0 /* or set this based on some counter? */<br> },options||{})), this);<br> },<br> ....<br> beforeSetup: function(effect) {<br> effect.index = effect.options.index;<br> },<br> beforeStartInternal: function(effect) {<br> effect.index = effect.options.index;<br> }<br> }; <br> var i=5;<br> new Effect.EffectRequiringIndex(''elementid'',{index:i});<br> <br> 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.<br> Depending on where you want to set i, you may not need to extend initialize.<br> <br> Colin<br> <br> Ian Tyndall wrote: <blockquote cite="mid45101A45.9040900-ue636x8T32g@public.gmane.org" type="cite"> <pre wrap="">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? </pre> <blockquote type="cite"> <pre wrap="">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 </pre> <pre wrap=""> </pre> </blockquote> <pre wrap=""><!----> </pre> </blockquote> <br> --~--~---------~--~----~------------~-------~--~----~<br> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. <br> To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <br> To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <br> For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs <br> -~----------~----~----~----~------~----~------~--~---<br> </body> </html> <br>
Thanks, that got what I needed... I didn''t know about the beforeSetup option. Much thanks, Ian> 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs -~----------~----~----~----~------~----~------~--~---