5 Replies Latest reply on Jan 4, 2008 6:42 AM by peterent

    How to return instance after creation complete

    ScottCanada Level 1
      The following code is to implement a single instance in a method. However, we should make sure that the instance is created completely. Any idea?
      var static instance:myObject = null;
      public getInstance():myObject
      {
      if (instance == null)
      {
      instance = new myObject();
      //??? waiting for creationCompleted?
      }
      return instance;
      }

      addEventListener could be used to register a function to handle the event of creationCompleted. However, the function should be another method. Thanks in advanced.