2 Replies Latest reply on Oct 16, 2006 12:57 PM by leotemp

    First Package, small problem

    leotemp Level 1
      Can someone please explain how you need to properly define a package, i keep getting told that i have to many public or private functions and all kinds of stuff, my package below throws "Cant have more then one externally visible definition" What does this mean and why, i just want to understand this concept.

      package Generic
      {
      import mx.effects.*;
      var hideFade:Effect = new mx.effects.Fade();

      public class UI
      {
      public static function componentHide(obj:Object,dur:Number):void
      {
      hideFade.target = obj;
      hideFade.duration= dur;
      hideFade.play();
      }
      }
      }
        • 1. Re: First Package, small problem
          leotemp Level 1
          Ok so i moved my effect into my class and it fixed that "multiple visible definitions" error but now my function cant "see" my effect, as if its not defined.. "Access of undefined property hideFade".. what?

          package Generic
          {
          import mx.effects.*;
          public class UI
          {
          public var hideFade:Effect = new mx.effects.Fade();
          public static function componentHide(obj:Object,dur:Number):void
          {
          hideFade.target = obj; // THROWS ERROR //
          }
          }
          }
          • 2. Re: First Package, small problem
            leotemp Level 1
            okay, so the effect goes in the function, what i dont understand is wont this create a new effect every time the function is called or is that just wrong.