Re: [flexcoders] Re: Ending an Effect
Thanks for the thought, Lar. It still isn't quite working right, but now I'm able to test for the object over which the mouse is. The below trace returns this: currentarget in rollOver is TEST0.Canvas4.img1; lastTarget was TEST0.Canvas4.img3 currentarget in rollOut is TEST0.Canvas4.img3; lastTarget was TEST0.Canvas4.img3 The images will only be different on the rollOver event -- not the rollOut, since the 'lastTarget' image over which the mouse is rolled out will always be the same as the one over which it was rolled in. Now that I can detect the target, I'm just not sure what to do with it. :) The logic should be: 'you're over a new image, then complete the last zoom and start this new one.' (Or even: 'end the last one using end() and start this one.') Can anyone see how to do this? var lastTarget:Object; public function doZoom(event:MouseEvent):void { trace("currentarget in " + event.type + " is " + event.currentTarget + "; lastTarget was " + lastTarget); if (zoomAll.isPlaying) { zoomAll.reverse(); } else { if(event.currentTarget == lastTarget) { // If this is a ROLL_OUT event, play the effect backwards. // If this is a ROLL_OVER event, play the effect forwards. zoomAll.play([event.target], event.type == MouseEvent.ROLL_OUT ? true : false); } } //set the external variable to the current target to be able to compare it the next //time the event fires. lastTarget = event.currentTarget; } - Original Message From: lar.drolet <[EMAIL PROTECTED]> To: flexcoders@yahoogroups.com Sent: Monday, January 8, 2007 2:49:32 PM Subject: [flexcoders] Re: Ending an Effect Just a thought but how about capturing when the zoom effects ends (EffectEnd or Event.COMPLETE) and then checking if the Mouse is over the same object. If not then call the reverse right away. LD --- In [EMAIL PROTECTED] ups.com, David Steele <[EMAIL PROTECTED]> wrote: > > Hi, > > I'm applying the zoom effect to multiple UIComponents on a canvas. If I move the mouse quickly off one zoomed component and onto another, sometimes the first will not reverse to its original size. I believe this is because the isPlaying flag is true if *any* instances of the effect are currently playing. Does anyone know a solution for this? I want instance one to shrink back down to original size even if I move quickly to instance 2. > > > TIA > > Code: > > public function doZoom(event: MouseEvent) :void { > if (zoomAll.isPlaying) { > zoomAll.reverse( ); > } > else { > // If this is a ROLL_OUT event, play the effect backwards. > // If this is a ROLL_OVER event, play the effect forwards. > zoomAll.play( [event.target] , event.type == MouseEvent.ROLL_ OUT ? true : false); > if(event.type == "rollOut"){ > zoomAll.end( ); > } > // > } > } > - Original Message From: lar.drolet <[EMAIL PROTECTED]> To: flexcoders@yahoogroups.com Sent: Monday, January 8, 2007 2:49:32 PM Subject: [flexcoders] Re: Ending an Effect Just a thought but how about capturing when the zoom effects ends (EffectEnd or Event.COMPLETE) and then checking if the Mouse is over the same object. If not then call the reverse right away. LD --- In [EMAIL PROTECTED] ups.com, David Steele <[EMAIL PROTECTED]> wrote: > > Hi, > > I'm applying the zoom effect to multiple UIComponents on a canvas. If I move the mouse quickly off one zoomed component and onto another, sometimes the first will not reverse to its original size. I believe this is because the isPlaying flag is true if *any* instances of the effect are currently playing. Does anyone know a solution for this? I want instance one to shrink back down to original size even if I move quickly to instance 2. > > > TIA > > Code: > > public function doZoom(event: MouseEvent) :void { > if (zoomAll.isPlaying) { > zoomAll.reverse( ); > } > else { > // If this is a ROLL_OUT event, play the effect backwards. > // If this is a ROLL_OVER event, play the effect forwards. > zoomAll.play( [event.target] , event.type == MouseEvent.ROLL_ OUT ? true : false); > if(event.type == "rollOut"){ > zoomAll.end( ); > } > // > } > } > > _ _ _ _ __ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail. yahoo.com > __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: [flexcoders] Re: Ending an Effect
Thanks for the thought, Lar. It still isn't quite working right, but now I'm able to test for the object over which the mouse is. The below trace returns this: currentarget in rollOver is TEST0.Canvas4.img1; lastTarget was TEST0.Canvas4.img3 currentarget in rollOut is TEST0.Canvas4.img3; lastTarget was TEST0.Canvas4.img3 The images will only be different on the rollOver event -- not the rollOut, since the 'lastTarget' image over which the mouse is rolled out will always be the same as the one over which it was rolled in. Now that I can detect the target, I'm just not sure what to do with it. :) The logic should be: 'you're over a new image, then complete the last zoom and start this new one.' (Or even: 'end the last one using end() and start this one.') Can anyone see how to do this? Thanks... var lastTarget:Object; public function doZoom(event:MouseEvent):void { trace("currentarget in " + event.type + " is " + event.currentTarget + "; lastTarget was " + lastTarget); if (zoomAll.isPlaying) { zoomAll.reverse(); } else { if(event.currentTarget == lastTarget) { // If this is a ROLL_OUT event, play the effect backwards. // If this is a ROLL_OVER event, play the effect forwards. zoomAll.play([event.target], event.type == MouseEvent.ROLL_OUT ? true : false); } } //set the external variable to the current target to be able to compare it the next //time the event fires. lastTarget = event.currentTarget; } - Original Message From: lar.drolet <[EMAIL PROTECTED]> To: flexcoders@yahoogroups.com Sent: Monday, January 8, 2007 2:49:32 PM Subject: [flexcoders] Re: Ending an Effect Just a thought but how about capturing when the zoom effects ends (EffectEnd or Event.COMPLETE) and then checking if the Mouse is over the same object. If not then call the reverse right away. LD --- In [EMAIL PROTECTED] ups.com, David Steele <[EMAIL PROTECTED]> wrote: > > Hi, > > I'm applying the zoom effect to multiple UIComponents on a canvas. If I move the mouse quickly off one zoomed component and onto another, sometimes the first will not reverse to its original size. I believe this is because the isPlaying flag is true if *any* instances of the effect are currently playing. Does anyone know a solution for this? I want instance one to shrink back down to original size even if I move quickly to instance 2. > > > TIA > > Code: > > public function doZoom(event: MouseEvent) :void { > if (zoomAll.isPlaying) { > zoomAll.reverse( ); > } > else { > // If this is a ROLL_OUT event, play the effect backwards. > // If this is a ROLL_OVER event, play the effect forwards. > zoomAll.play( [event.target] , event.type == MouseEvent.ROLL_ OUT ? true : false); > if(event.type == "rollOut"){ > zoomAll.end( ); > } > // > } > } > > _ _ _ _ __ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail. yahoo.com > __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
[flexcoders] Re: Ending an Effect
Just a thought but how about capturing when the zoom effects ends (EffectEnd or Event.COMPLETE) and then checking if the Mouse is over the same object. If not then call the reverse right away. LD --- In flexcoders@yahoogroups.com, David Steele <[EMAIL PROTECTED]> wrote: > > Hi, > > I'm applying the zoom effect to multiple UIComponents on a canvas. If I move the mouse quickly off one zoomed component and onto another, sometimes the first will not reverse to its original size. I believe this is because the isPlaying flag is true if *any* instances of the effect are currently playing. Does anyone know a solution for this? I want instance one to shrink back down to original size even if I move quickly to instance 2. > > > TIA > > Code: > > public function doZoom(event:MouseEvent):void { > if (zoomAll.isPlaying) { > zoomAll.reverse(); > } > else { > // If this is a ROLL_OUT event, play the effect backwards. > // If this is a ROLL_OVER event, play the effect forwards. > zoomAll.play([event.target], event.type == MouseEvent.ROLL_OUT ? true : false); >if(event.type == "rollOut"){ > zoomAll.end(); >} >// > } > } > > __ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com >