2009-12-03 16 views
0

我试图在rollOut和rollOut消失时使用发光效果创建一些影片剪辑。但是,当rollOut完成后,我应用过滤器的背景动画片段(一个简单的20 x 20矢量圆圈)突然出现锯齿状,在rollOver/rollOut之前它看起来应该是平滑的。这里会发生什么?GlowFilter和其他一些问题后,矢量形状出现锯齿状

我很新的AS3,因此该示例尚未正常工作。例如:
*当您第一次翻转该项目时,它立即显示发光的结束阶段而不是动画。我以为我会在构造函数中用Tween.rewind()绕开这个问题,但那并不能解决问题。 *我也不确定是否将TweenEvent.MOTION_CHANGE的addEventListener放置在正确的位置。我试图把它放在构造函数中,但这导致事件被_onMotionChange连续接收。

对这些问题的一些帮助非常感谢。但最重要的部分是辉光滤波器消失后的锯齿状的圆。

这是我迄今为止(简称为例):

package 
{ 
    import flash.events.*; 
    import flash.display.*; 
    import flash.text.*; 
    import flash.utils.*; 
    import flash.filters.GlowFilter; 
    import fl.transitions.Tween; 
    import fl.transitions.TweenEvent; 
    import fl.transitions.easing.*; 

    public class ScoreListItem extends MovieClip 
    { 

     private var _glowFilter:GlowFilter; 
     private var _tweenGlowFilterBlurX:Tween; 
     private var _tweenGlowFilterBlurY:Tween; 

     public function ScoreListItem():void 
     { 

      _glowFilter = new GlowFilter(0xffffff, 1, 3, 3, 2, 1, false, false); 
      _tweenGlowFilterBlurX = new Tween(_glowFilter, 'blurX', Strong.easeIn, 1, 5, .8, true); 
      _tweenGlowFilterBlurY = new Tween(_glowFilter, 'blurY', Strong.easeIn, 1, 5, .8, true); 

      _tweenGlowFilterBlurX.rewind(); 
      _tweenGlowFilterBlurY.rewind(); 

      addEventListener(MouseEvent.ROLL_OVER, _onRollOver); 
      addEventListener(MouseEvent.ROLL_OUT, _onRollOut); 
     } 

     private function _onRollOver(event:Event) 
     { 
      trace('rollOver'); 
      _tweenGlowFilterBlurY.addEventListener(TweenEvent.MOTION_CHANGE, _onMotionChange); 
      _tweenGlowFilterBlurX.continueTo(5, 1); 
      _tweenGlowFilterBlurY.continueTo(5, 1); 
     } 

     private function _onRollOut(event:Event) 
     { 
      trace('rollOut'); 
      _tweenGlowFilterBlurY.addEventListener(TweenEvent.MOTION_CHANGE, _onMotionChange); 
      _tweenGlowFilterBlurX.continueTo(1, 1); 
      _tweenGlowFilterBlurY.continueTo(1, 1); 
     } 

     private function _onMotionChange(event:Event) 
     { 
      trace('motionChange'); 
      this.backgroundCircle.filters = [ _glowFilter ]; 
     } 

    } 
} 

回答

0

我能够通过当它在_onRollOut通过添加TweenEvent.MOTION_FINISH的事件侦听完成删除过滤器简单地解决我的问题。这样,矢量圆形的锯齿状边缘消失了,再次显示正常。

private function _onRollOut(event:MouseEvent) 
{ 
    _tweenGlowFilterBlurY.addEventListener(TweenEvent.MOTION_FINISH, _onRollOutFinish); 
    /* etc... */ 
} 

private function _onRollOutFinish(event:TweenEvent) 
{ 
    this.label.filters = []; 
}