Either I'm completely missing some notice of hotfix changes, or the
effect events have changed in the last hotfix (I just finally
installed it today). I'm trying to do something very basic - when the
mouse rolls out, I want to fade out an object. When the mouse rolls
over, I want the object to fade in. If you roll back over/out while an
effect is running, I want it to end running the new event and just
*reverse* the last effect. Simple right? Not after 4 hours of drilling
at this...and here's why:

Using the hideEffect/showEffect, let's say you mouse over a button,
setting some canvas.visible=true, and it starts to fade in. Now before
it finishes, you mouse out, causing canvas.visible=false, which should
check "if fade in is playing, reverse fade in" *but* soon as
visible=false goes, the original fade in effect is canceled! Check out
the code (I've stripped out the isPlaying logic to make this easier to
see) - if you mouseOver the button and mouseOut immediately, you will
see an "EFFECT ENDED" even though I never tell it to end the original
mouseOver. Somehow changing the visible property is causing the event
to end prematurely, so isPlaying isn't true when the mouseOut event
triggers, so I can't ever reverse it! Help! Why would changing the
visible property cancel any event attached to show/hide?

I'm about 99% sure this code worked before the hotfix (SVN, gotta love
it) since I was checking for isPlaying and it would correctly reverse
the effect. Any ideas?


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="absolute">
  <mx:Script>
    <![CDATA[
      import mx.events.EffectEvent;

      private function onEffectStart(event:EffectEvent):void {
        trace("EFFECT STARTED:"+event.target);
        trace("FadeOutPlaying:"+fadeOut.isPlaying);
        trace("FadeInPlaying:"+fadeIn.isPlaying);
      }

      private function onEffectEnd(event:EffectEvent):void {
        trace("EFFECT ENDED:"+event.target);
        trace("FadeOutPlaying:"+fadeOut.isPlaying);
        trace("FadeInPlaying:"+fadeIn.isPlaying);
      }
    ]]>
  </mx:Script>
  <mx:Fade id="fadeOut" duration="3000"  alphaTo="0.0"
effectStart="onEffectStart(event)" effectEnd="onEffectEnd(event)"  />
  <mx:Fade id="fadeIn"  duration="3000"  alphaTo="1.0"
effectStart="onEffectStart(event)" effectEnd="onEffectEnd(event)"  />

  <mx:Canvas id="canvas1"
             x="50"
             width="300" height="300"
             visible="false" backgroundColor="red" backgroundAlpha="1"
             hideEffect="fadeOut" showEffect="fadeIn" />

  <mx:Button id="button1" rollOut="canvas1.visible = false"
rollOver="canvas1.visible = true"/>
</mx:Application>

Reply via email to