5 Replies Latest reply: Jun 1, 2012 9:34 PM by kglad RSS

    Help Getting Started w/Classes

    voxL Community Member

      Hi:

      I'd like to setup a class file to store functions that I use frequently, not sure how to do it, but I think I'm close.  Here's a simple example that doesn't quite work, I get error:

       

      import PFarmFunctions;

      PFarmFunctions.fadeMe (mc,"off",1,1);

       

      Call to a possibly undefined method fadeMe through a reference with static type Class.

       

      My code is:

      package {

      import com.greensock.*;

      import com.greensock.easing.*;

      import com.greensock.plugins.*;

       

      import fl.events.*;

       

      import flash.display.DisplayObject;

      import flash.display.MovieClip;

      import flash.events.Event;

      import flash.display.Sprite;

       

      public class PFarmFunctions {

      private var who:Object;

      private var onOff:String;

      private var delayTime:Number;

       

      public function fadeMe(who:Object, onOff:String, howLong:Number, delayTime:Number):void {

      if (onOff == 'off') TweenMax.to(who, howLong,{autoAlpha:0,delay:delayTime});

      }; //End fadeMe

      }

       

      }

      If someone could help me get going on this, I'd appreciate it very much.

      Thanks.