views:

51

answers:

1

So I hava array Links and array Params with same langth N

So what I need is to create an object where for each link from Links I will be able to see param from Params

And than for example to be abble to call something like

for each( item in object) 
if (item.param == "some value") {
// some code
} else...

How to do such thing (Code exaMple, please)

+1  A: 

From Array: You could first build a list with elements composed of a item and a param (supposing the length is indeed the same for both lists)

var items:Array = new Array();

for(var i:uint = 0; i < links.length; i++) {
   links:Array .push({link:links[i], param:params[i]});
}

You can then filter them easily:

items.forEach(checkValue);

for(var i:uint = 0; i < items.length; i++) {
  if (items[i].param == "some value") {
    // some code
  } else{
    ...
  }
}
VonC