Link to home
Start Free TrialLog in
Avatar of befidled
befidled

asked on

How to compare values in an array

I've got a Flash movie that is loading in some variables from the URL string. One of the variables is a product ID. When I load this ID I need to be able to compare  it to values within an array to pull out the record with a matching product ID. What is the best approach?
ASKER CERTIFIED SOLUTION
Avatar of kishoregp
kishoregp
Flag of United Arab Emirates image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Aneesh Chopra
my 2 cents to make it more robust..

for (var i in my_array){
  if (String(my_array[i]) == String(produceID)){
    trace("matched array item is : "+my_array[i]) ;
    break;
  }
}
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial