4 Replies Latest reply on Feb 26, 2009 1:33 PM by Newsgroup_User

    Where to addEventListener

    ohseegee
      I have a Flex 3 window with a form in it (defined in the designer), and a combobox on the form is bound to an ArrayCollection I have defined in the script portion of that same file.

      When my window is complete (window's creationComplete event) I fire off a method to fill the arraycollection which populates a combobox - and that works! Now, the problem...

      As soon as the arrayCollection is populated, I also want to call a function to make a few other changes to the form. I think that the best way to do that is by adding a addEventListener to the array collection. But, where do I add the eventlistener? I've tried adding it in various places (window complete/prep events, form complete events, etc), but I keep getting a runtime error that the arraycollection variable is null (TypeError: Error #1009: Cannot access a property or method of a null object reference).

      Why would my arraycollection be null at this point? I don't get it...

      So....HELP! Where do I add this listener:
      quote:

      phpAccess.energyProviders.addEventListener(CollectionEvent.COLLECTION_CHANGE, populateForm, false, 0, false);


      Thanks!