2 Replies Latest reply on Sep 29, 2006 5:26 AM by Oh_Mitch_!

    Need precision on dynamically allocated objects

    Oh_Mitch_!
      Hi all,

      For example, I declare this class :


      package Global
      {
      public class GV
      {
      public static var gLogin:String="123";
      public static var gPassword:String="4567";

      public function test(t:int):int {
      return t+1;
      }
      }

      }


      Flex lets me use my class this way to access a static member :

      import Global.*;
      GV.gLogin='XXX';

      In this case, a GV object is dynamically allocated and the static member is set.

      Now I want to call the test method using the same dyn alloc :

      import Global.*;
      GV.test(123);

      Flex gives me a "Unknown method" error.

      So this is my question : Why can I access a static member but not a method on a dyn alloc object ? Is there a way to do this ?
      Thank you for your help :-)

      MiF