Also ...

every effect has "afterFinish" automaticaly run through it!...

Example:

Effect.Fade('element',{
afterFinish : function() {
alert('I have now finished');
}

});

Just incase you didnt know that!


Alex Mcauley
http://www.thevacancymarket.com
----- Original Message ----- 
From: "Alex McAuley" <webmas...@thecarmarketplace.com>
To: <prototype-scriptaculous@googlegroups.com>
Sent: Wednesday, August 26, 2009 9:16 AM
Subject: [Proto-Scripty] Re: complete handler for effects.js


>
> You have put a trailing comma on the last option wich will cause an error 
> in
> IE !!!...
>
>
> Alex Mcauley
> http://www.thevacancymarket.com
> ----- Original Message ----- 
> From: "Scott Haines" <sc...@newfrontproductions.com>
> To: "Prototype & script.aculo.us" 
> <prototype-scriptaculous@googlegroups.com>
> Sent: Wednesday, August 26, 2009 2:36 AM
> Subject: [Proto-Scripty] complete handler for effects.js
>
>
>>
>> In case anyone has run into the need to have an onComplete style
>> handler for effects.js I have made a successful addition to the source
>> code.
>>
>> Step 1:
>> In the main effect.js code skip to about line 100, it should look like
>> this:
>>
>> DefaultOptions: {
>>    duration:   1.0,   // seconds
>>    fps:        100,   // 100= assume 66fps max.
>>    sync:       false, // true for combining
>>    from:       0.0,
>>    to:         1.0,
>>    delay:      0.0,
>>    queue:      'parallel',
>>    complete:   0,
>>  },
>>
>> You are adding 'complete: 0,' to the defaults, this will allow you to
>> run a subsequent function once the effect has completed. (This is the
>> first step of three).
>>
>> Step 2:
>> Register the function within the Effect you would like to extend the
>> onComplete handler to. I needed this for the Effect.Fade and
>> Effect.Appear functions.
>>
>> Example: Effect.Fade (starts around line 535)
>>
>> Effect.Fade = function(element) {
>>  element = $(element);
>>  var oldOpacity = element.getInlineOpacity();
>>  var options = Object.extend({
>>    from: element.getOpacity() || 1.0,
>>    to:   0.0,
>>    afterFinishInternal: function(effect) {
>>         if(effect.options.complete != 0){
>>      effect.options.complete();
>>         }
>>      if (effect.options.to!=0) return;
>>      effect.element.hide().setStyle({opacity: oldOpacity});
>>    }
>>  }, arguments[1] || { });
>>  return new Effect.Opacity(element,options);
>> };
>>
>> *on the afterFinishInternal you know that the effect has finished, so
>> you then ask whether or not the option for complete (onComplete) was
>> issued and piped into the function, if so you allow Javascript to read
>> the string as a function and you are golden.
>>
>> Step 3: Using the onComplete (complete) option in your code.
>>
>> example:
>> function fadeObj(obj,func){
>> Effect.Fade($(obj),{duration:1,complete:func});
>> }
>>
>> function setInStone(){
>> alert('onComplete handler working for effects.js');
>> }
>>
>> usage:
>> fadeObj('fadediv',setInStone);
>>
>> I hope this helps anyone else who ran into the same issue. I wanted to
>> simulate the functionality of the caurina Tweener methods from
>> actionscript 3, or the complete handler from the SPRY lib in the more
>> useful effect.js.
>>
>> Cheers,
>> Scott Haines
>> Newfront Creative
>> http://www.newfrontcreative.com
>>
>>
>>
>>
>> >
>>
>
>
> >
> 


--~--~---------~--~----~------------~-------~--~----~
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-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to