I am developing an application in Flex. There are 20+ 'pages', each with its own form. I need to collect all the entered data and pass it to an API method. What I am wondering is when I should begin to pass the data and what the best way to collect it might be. I was thinking of instantiating a class

public class myCollectorClass

The API method has 10 parameters, 4 of which are not determined by the forms. Of the 6 remaining parameters, 5 are simple strings with few options. Those are not the difficult part. It is the last parameter that is the most difficult to work with:

public var myDataSet:DataSet[]; //DataSet is a data type from the API

The forms fall into two categories: Geographical Data which controls the geographical area of the API return values. And Search Data which controls the type of data returned within the geographical parameters. For instance, if you are looking for an IT company in the US Zip code 93003.

As you can see, the geo and search parameters are arrays not simple strings and a typical collection will contain multiple zip coes, area codes SCBA codes etc., as well as hundreds of search parameters.

Would it be better for me to pass each selected value to the array each time a value is entered?

btnAddParameter.addEventListener(Event.CLICK, dataHandler)

Or pass all of the values at the end right before an order is placed?

for each dataContainer in myClass
    var dataObj:Object;
    dataContainer.value = dataObj;
  • 2
    20 pages? I'd hate to have to fill that out.... Jun 17, 2011 at 22:42
  • Agreed. The graphic designer is responsible for that. She made this cool looking Accordion nested in a TabNav that is very difficult to program. The funny thing is the app that the API comes from does exactly what I am trying to do but they have all of the selections on one scrollable page. My boss does not like to "scroll down"... Jun 17, 2011 at 22:45
  • 1
    Sounds to me like your graphic designer isn't a user interface and usability expert.. Something you may want to look into. That number of pages would immediately short circuit my want to subscribe. Jun 17, 2011 at 23:22

2 Answers 2


I would opt for an item-by-item feed to the server. This not only protects against the poor user having to re-input all of that stuff, it also gives you the chance to do on-the-fly modifications of the form.

  • Yeah that's a good point. It would also allow me to let them save their forms to come back to later. Is that going to slow the app's performance down though? Jun 17, 2011 at 22:49
  • @steve: Slow it down? I kind of doubt it; we're dealing with "people speed" here. As soon as they move off a field and you get a onBlur event (or whatever the Flex equivalent is) then you write it out in the background. Jun 17, 2011 at 22:52

I like your idea of saving everything in a "collector class" for two reasons. One, it makes sense to perform everything at once at the end of the process, so you may as well have easy access to all of the information collected along the way. And two, having everything that you need stored away allows you to create state within your application. That way, if a user wants to exit the program and come back later (to finish all 20 pages), you could easily serialize their data to an external data source, then deserialize it back into the application when they're ready to continue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.