actionscript 3 - as3 check for 2 objects with same property in array -


I have an array, call it _persons I am making this object popular with value objects, this object Calling PersonVO

Everyone has the name and score properties of VO.

What am I trying to do, array & amp;

  // PSEUDO code 1 Find any VO with same name (should only be maximum 2) Compare properties compared to 2 digits 3 Keep VO with only the highest score And delete the _persons array from the other  

I'm having trouble with code implementation, any AS3 wizard capable of helping you?

You better dictionary for this task, because you have to query A specific unique asset is a dictionary approach is viable, in case you have only one major property in name , and you should have only one object at any time in this property. An example:

  High Highscore: Dictionary; // Load it anyway addHighscore function (name: string, score: number): Boolean {// returns if the score is bigger than stored, aka private best prev prev :core = highscores [name] ; If (INNAN (ProstScore) || (Prestocor Lt; Score)) {// No score, or fewer scores - Write a new value highscore [name] = score; Back true; } / / Others do not write, it is less than the new scores, which is incorrect; }  

In this example, the dictionary uses the pass string as the name property, which is the "primary key", thus in all records the specific < Code should be named , the score passed in the function is the value share of stored records. You can store more than one property in value in the dictionary, you have to wrap it in an object in this case.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -