1 Reply Latest reply on Apr 21, 2008 9:44 PM by levancho

    Selecting certain data from Array

      Here is the issue I am faced with.

      I am currently using an HTTPService call to a PHP document that builds XML. I then take that XML and place it into an Array, (pretty basic as you can tell.)

      What I am dealing with is that I have 15 tabs that all contain similar "notes" sections. I would really like to run 1 HttpService that returns all of the data form the notes, (note data, username of note) and then placing the appropriate notes data to the appropriate tab and data grid container.

      So I didn't know if there was a way you could select only a certain part of an Array and then populate a datagrid with that particular data?

      Almost like cutting pieces of a large array out and displaying thos pieces on different tabs.

      Any help is appreciated.
        • 1. Re: Selecting certain data from Array
          levancho Level 3
          Array has many functions that you can use to do pretty much anythin goyu eant on it,

          filter () method
          AS3 function filter(callback:Function, thisObject:* = null):Array

          Executes a test function on each item in the array and constructs a new array for all items that return true for the specified function. If an item returns false, it is not included in the new array.
          map () method
          AS3 function map(callback:Function, thisObject:* = null):Array

          Executes a function on each item in an array, and constructs a new array of items corresponding to the results of the function on each item in the original array.


          etc .. look up in API documents it has examples too :