2 Replies Latest reply on Nov 17, 2007 12:56 AM by nmduc073

    Incompatible override?

    nmduc073
      Hi,
      I have copied and run this code from a book:
      [CODE]
      <?xml version="1.0"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml"
      xmlns:comps="*"
      backgroundColor="#FFFFFF">

      <comps:CustomEffect id="effect" scaleTo="2" target="{btn}"/>

      <mx:Panel title="Custom Effect Example" width="250" height="125"
      paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10"
      layout="absolute">

      <mx:Button id="btn" label="Roll Over Me"
      rollOver="effect.play()"
      rollOut="effect.reverse()"
      horizontalCenter="0" verticalCenter="0" />

      </mx:Panel>
      </mx:Application>

      [/CODE]

      [CODE]
      package
      {
      import mx.effects.Effect;
      import mx.effects.EffectInstance;

      public class CustomEffect extends Effect {

      // Define scaleTo parameter
      public var scaleTo:Number;

      public function CustomEffect(targetObj:Object = null) {
      super(targetObj);
      instanceClass= CustomEffectInstance;
      }

      // override getAffectedProperties() and
      // pass the properties effected
      override public function getAffectedProperties():Array {
      return ["scaleX,scaleY"];
      }

      // Override initInstance()
      override protected function initInstance(inst:EffectInstance):void {
      super.initInstance(inst);
      CustomEffectInstance(inst).scaleTo = scaleTo;
      }
      }
      }
      [/CODE]

      However, it generated an error in the line
      override protected function initInstance(inst:EffectInstance):void {

      The content of the message is Incompatible override.

      Please tell me how to fix it.
      Thank in advance.