RE: [Flashcoders] Sort within an object ....

2006-06-19 Thread Steven Sacks | BLITZ
Sorry.  Yes to your first question.  No to your second. 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Steven
Sacks | BLITZ
Sent: Monday, June 19, 2006 5:58 PM
To: Flashcoders mailing list
Subject: RE: [Flashcoders] Sort within an object 

Yes, objects are hashes.


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Stephen
Ford
Sent: Monday, June 19, 2006 5:28 PM
To: flashcoders
Subject: [Flashcoders] Sort within an object 

I thought all objects were associative arrays ?
 
Is this incorrect ?
 
Stephen.___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training http://www.figleaf.com
http://training.figleaf.com
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training http://www.figleaf.com
http://training.figleaf.com
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] Sort within an object ....

2006-06-19 Thread Steven Sacks | BLITZ
Yes, objects are hashes.


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Stephen
Ford
Sent: Monday, June 19, 2006 5:28 PM
To: flashcoders
Subject: [Flashcoders] Sort within an object 

I thought all objects were associative arrays ?
 
Is this incorrect ?
 
Stephen.___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training http://www.figleaf.com
http://training.figleaf.com
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


[Flashcoders] Sort within an object ....

2006-06-19 Thread Stephen Ford
I thought all objects were associative arrays ?
 
Is this incorrect ?
 
Stephen.___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] Sort within an object

2006-06-19 Thread Mendelsohn, Michael
Well, thanks everyone for the advice.  I ended up solving the issue, and
below is my final code.  Sorry if I confused anyone.

- MM


private function updateStandings():Void {
var tempStandings:Array = new Array();
// first, create list of scores and sort descending...
var tempScores:Array = new Array();
for (var s = 1; s < 9; s++) {
tempScores.push(Number(_root["t" +
s].pieces.text.substring(0, (_root["t" + s].pieces.text.lastIndexOf("
");
}
tempScores.sort(2);
// next, match scores to tables by going through
tempScores and finding a table with that value
// then picking it out of tempTables...
var tempTables:Array = new Array(1, 2, 3, 4, 5, 6, 7,
8);
for (var h = 0; h < tempScores.length; h++) {
for (var t = 0; t < tempTables.length; t++) {
if (track["table" +
tempTables[t]]["score"] == tempScores[h]) {

tempStandings.push(tempTables[t]);
tempTables.splice(t, 1);
}
}
}
// now, sort the scorePanels vertically...
for (var k = 0; k < tempStandings.length; k++) {
var theTable:MovieClip = _root["t" +
tempStandings[k]];
var newY:Number = track.standings.positions[k];
theTable._y = newY;
}
}

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Sort within an object

2006-06-19 Thread Charles Parcell

There is some confusion here. These two different statements you have made
don't add up.

In your first post you sited the example:
Track[1][score]
Track[2][score]
Track[3][score]
Track[4][score]
Track[5][score]

These are nested arrays.

But in the code listed here you have the line of code:
if(_root.puz["track"]["table" + t]["score"] == tempScores[i])

This code would trace out something like...
// _root.puz.track.table1.score

This is indeed an object tree.

Since it looks like you actually are building object trees, I would suggest
you look at using a Bubble sort.


The version sited here is a bit less elegant than the recursive version, but
it works just the same.

Charles P.



On 6/19/06, Mendelsohn, Michael <[EMAIL PROTECTED]> wrote:


> is Track an array?
Track is an object.


This is my work in progress...

private function updateStandings():Void {
// create list of scores and sort descending...
var tempScores:Array = new Array();
for (var s = 1; s < 9; s++) {
tempScores.push(_root["t" +
s].pieces.text.substring(0, (_root["t" + s].pieces.text.lastIndexOf("
";
}
tempScores.sort(2);
// match scores to tables by going through tempScores
and finding a table with that value, then throwing it out of
tempTables...
var tempTables:Array = new Array(1,2,3,4,5,6,7,8);
var newStandings:Array = new Array();
for(var i=0;ihttp://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] Sort within an object

2006-06-19 Thread Merrill, Jason
>>> is Track an array?
>>Track is an object.

Why would it be an object?  Unless I don't get what you're trying to do
(which is possible) "Track" should instead be an array, containing
objects, as in my example.  AKA a named element array.

Jason Merrill
Bank of America 
Learning Technology Solutions
 
 
 
 
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] Sort within an object

2006-06-19 Thread Mendelsohn, Michael
> is Track an array?
Track is an object.


This is my work in progress...

private function updateStandings():Void {
// create list of scores and sort descending...
var tempScores:Array = new Array();
for (var s = 1; s < 9; s++) {
tempScores.push(_root["t" +
s].pieces.text.substring(0, (_root["t" + s].pieces.text.lastIndexOf("
";
}
tempScores.sort(2);
// match scores to tables by going through tempScores
and finding a table with that value, then throwing it out of
tempTables...
var tempTables:Array = new Array(1,2,3,4,5,6,7,8);
var newStandings:Array = new Array();
for(var i=0;ihttp://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Sort within an object

2006-06-19 Thread janosch

Hello,

is Track an array?

Janosch

Mendelsohn, Michael schrieb:


Hi list...

Is there any way to sort within an object:

Track[1][score]
Track[2][score]
Track[3][score]
Track[4][score]
Track[5][score]

All the tracks have different score numeric values.  What's the most
efficient way of getting them in order?  It seems sort and sortOn only
work on arrays.

Thanks,
- Michael M.

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


 



___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] Sort within an object

2006-06-19 Thread Merrill, Jason
How about a for loop combined with a temp array?

function sortScores(dataArray:Array):Array{
var tempArr:Array = new Array();
for(var i=0; i>-Original Message-
>>From: [EMAIL PROTECTED] [mailto:flashcoders-
>>[EMAIL PROTECTED] On Behalf Of Mendelsohn, Michael
>>Sent: Monday, June 19, 2006 2:07 PM
>>To: Flashcoders mailing list
>>Subject: [Flashcoders] Sort within an object
>>
>>Hi list...
>>
>>Is there any way to sort within an object:
>>
>>Track[1][score]
>>Track[2][score]
>>Track[3][score]
>>Track[4][score]
>>Track[5][score]
>>
>>All the tracks have different score numeric values.  What's the most
>>efficient way of getting them in order?  It seems sort and sortOn only
>>work on arrays.
>>
>>Thanks,
>>- Michael M.
>>
>>___
>>Flashcoders@chattyfig.figleaf.com
>>To change your subscription options or search the archive:
>>http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>
>>Brought to you by Fig Leaf Software
>>Premier Authorized Adobe Consulting and Training
>>http://www.figleaf.com
>>http://training.figleaf.com
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


[Flashcoders] Sort within an object

2006-06-19 Thread Mendelsohn, Michael
Hi list...

Is there any way to sort within an object:

Track[1][score]
Track[2][score]
Track[3][score]
Track[4][score]
Track[5][score]

All the tracks have different score numeric values.  What's the most
efficient way of getting them in order?  It seems sort and sortOn only
work on arrays.

Thanks,
- Michael M.

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com