0 Replies Latest reply on Jul 20, 2006 10:55 AM by mike2281

    [Bindable] ArrayCollection

    mike2281
      Here is the code, the problem is that set Modules only fires once, and does not fire when the collection changes, addItem() is used on the collection.

      Class containing array collection
      [Bindable]
      public class App
      {
      public function get Modules():ArrayCollection { return this._modules; }
      private var _ modules: ArrayCollection = new ArrayCollection ();

      public static function get Instance():App
      {
      if(!App._instance) App._instance = new App ();
      return App._instance;
      }
      private static var _instance: App;
      }

      Here is the binding mxml
      Modules=”{App.Instance.Modules}”

      Here is the set for Modules above and there is no get.
      public function set Modules(modules : ArrayCollection):void
      {
      Alert.show("modules="+modules.length);
      }

      Modules is only called once and is never called again when the collection changes, I verified this by creating a click event that manually updates Modules, just for debugging

      Here is the code for the test click event:
      public function onClick():void
      {
      this.Modules = WebApplication.Instance.WebCmsModules;
      }


      Also this works if use a var instead of a set but my problem is I need to fire some code when Modules is set so it cant be used.
      public var Modules:ArrayCollection;