# Class String -onSort() method

**URL:** <https://forum.kirupa.com/t/class-string-onsort-method/295332>\
**Category:** flash\
**Created:** [August 28, 2009, 8:45am UTC](https://forum.kirupa.com/t/class-string-onsort-method/295332 "2009-08-28T08:45:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mihaispr](https://avatars.discourse-cdn.com/v4/letter/m/53a042/32.png) [@mihaispr](https://forum.kirupa.com/u/mihaispr)\
**Post date:** [August 28, 2009, 8:45am UTC](https://forum.kirupa.com/t/class-string-onsort-method/295332/1 "2009-08-28T08:45:55Z")

</div>

I’m trying to implement onSort() function in actionscript2 regarding the criteria city (so I want to use onSort() by city criteria. My array name is vecteur that is included in class Array) .

here is the code:

```auto

var vecteur = new Array();
vecteur.push( { name: "bob", city: "omaha", zip: 68144 } );
vecteur.push( { name: "greg", city: "kansas city", zip: 72345 } );
vecteur.push( { name: "chris", city: "burlingame", zip: 94010 } );
vecteur.sortOn("city");

```

I want that he displays me this:

```auto

vec[0] = name: "chris", city: "burlingame", zip: 94010
vec[1] = name: "greg", city: "kansas city", zip: 72345
vec[2] = name: "bob", city: "omaha", zip: 68144 

```

He is displaying: [objet]…[objet]

Any ideas please?
