Re: [Proto-Scripty] Re: Pulse effect sometimes stopping on darkened version

2009-12-24 Thread Walter Lee Davis
You might find it easier to set up queues if you don't use inline  
code. Create an observer in the head of your page, and then you can  
keep all your code in one place and integrate the effects so they are  
aware of each other's existence and state.

document.observe('dom:loaded', function(){
Element.addMethods({
attractAttention: function(obj){
new Effect.Pulsate(obj, { pulses: 3, duration: 1, 
queue: this.id});
}
});
$('parentDiv').observe('mouseover',function(evt){
var elm = evt.element();
elm.identify(); //patch anything you didn't ID
switch(elm.id){
case 'foo':
$('foo_target').attractAttention();
break;
case 'bar':
$('bar_target').attractAttention();
break;
case 'baz':
$('baz_target').attractAttention();
break;
default:
break;
}
});
});

Hope this helps,

Walter

On Dec 24, 2009, at 2:19 AM, evilC wrote:

 As an afterthought, I guess it is by design.
 If you trigger it, it probably uses the current state as a starting
 point. I guess what is needed is a way to tell it to stop the current
 animation if triggered again before it finishes, or ignore subsequent
 requests until the current animation is complete.

 I tried queueing effects, but had no luck.

 --

 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 
 .



--

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




Re: [Proto-Scripty] Re: Pulse effect sometimes stopping on darkened version

2009-12-24 Thread Walter Lee Davis
Identify assigns an ID to the element if none exists, and that ID will  
persist until the page is done processing. Basically, it's a throw- 
away line to ensure that if the element that fired the event doesn't  
have an ID, the rest of your code doesn't go sproing. You could just  
as easily throw in an outer if(elm.id) test wrapped around the inner  
parts.

Queue works by allowing you to define as many different queues as you  
like, and for each queue, stacking up the effects that are fired  
within it so that they have to complete before another effect can  
begin. By passing the ID of the element as the queue name, you give  
each element its own stack of effects, keeping another effect from  
messing with it and giving each effect time to complete fully.

Walter

On Dec 24, 2009, at 3:00 PM, evilC wrote:

 Thanks walter, though I am not sure I understand that code.
 if the identify command assigns and ID, it returns it, but the code
 throws it away then does a switch on the id on the next line.
 It also appears that maybe I missed something about how queue works if
 you are passing it the id of the element.
 I will have to look into it, thanks muchly for your input.

 On Dec 24, 4:16 pm, Walter Lee Davis wa...@wdstudio.com wrote:
 You might find it easier to set up queues if you don't use inline
 code. Create an observer in the head of your page, and then you can
 keep all your code in one place and integrate the effects so they are
 aware of each other's existence and state.

 document.observe('dom:loaded', function(){
 Element.addMethods({
 attractAttention: function(obj){
 new Effect.Pulsate(obj, { pulses: 3,  
 duration: 1, queue: this.id});
 }
 });
 $('parentDiv').observe('mouseover',function(evt){
 var elm = evt.element();
 elm.identify(); //patch anything you didn't ID
 switch(elm.id){
 case 'foo':
 $('foo_target').attractAttention();
 break;
 case 'bar':
 $('bar_target').attractAttention();
 break;
 case 'baz':
 $('baz_target').attractAttention();
 break;
 default:
 break;
 }
 });

 });

 Hope this helps,

 Walter

 On Dec 24, 2009, at 2:19 AM, evilC wrote:

 As an afterthought, I guess it is by design.
 If you trigger it, it probably uses the current state as a starting
 point. I guess what is needed is a way to tell it to stop the  
 current
 animation if triggered again before it finishes, or ignore  
 subsequent
 requests until the current animation is complete.

 I tried queueing effects, but had no luck.

 --

 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 
 athttp://groups.google.com/group/prototype-scriptaculous?hl=en
 .

 --

 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 
 .



--

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