1 Reply Latest reply on Mar 16, 2007 5:08 PM by ntsiii

    Data Binding

      I have a page: JobSearch.mxml and when I select an item from a data grid and hit "Select" I want the new page (Timeline3.mxml) to remember the job_id of the selected item.

      Thanks to help from Doug, I know I need to set up some public variables and use databinding on the Timeline3 page.

      I just don't have any clue how to accomplish this.

      On JobSearch.mxml I tried to do:

      public var job_id:Number = currentJob.job_id;

      but when you start the app I get the error: Error #1009: Cannot access a property or method of a null object reference

      So, I'm thinking I need some sort of function to determine if the currentJob.job_id is null... Or maybe I don't need to have anything other than:
      public var job_id:Number and maybe flex will just automatically "know" that's the job_Id of the current job... I don't know, I'm having so much trouble and I'm so frustrated.

      So, then on the Timeline3.mxml page I have:
      public var job_id:Number;

      I know now I need some sort of data binding to hook up the two from one page to the other, but I don't know how to do that either.

      If someone could help, and explain WHY it's doing what it's doing, I would greatly appreciate it.


        • 1. Re: Data Binding
          ntsiii Level 3
          You cannot do complex assignments outside of a function:
          public var job_id:Number = currentJob.job_id;
          That is illegal. currentJob does not exist at that time, trust me. Try it in a function called by creationComplete