[flexcoders] How can I receive the smallest value within an Array?

2009-04-16 Thread sailorsea21
Hi everyone, if I have an array as

var boxSize:Array = new Array(25, 45, 32, 70, 50, 46, 80, 10);

Is there a function that will return me the smallest value within that array?

Thanks.

-David




Re: [flexcoders] How can I receive the smallest value within an Array?

2009-04-16 Thread - -
I got it:

public
{
{ 
{ 
value = array[i]; 
} 
} 
}functionmaxValue(array:Array):intvarvalue:int = array[0];vari:int = 
newint(0);for(i; iarray.length; i++) if(array[i]value)returnvalue;public
{
{ 
{ 
value = array[i]; 
} 
} 
}functionminValue(array:Array):intvarvalue:int = array[0];vari:int = 
newint(0);for(i; iarray.length; i++) if(array[i]value)returnvalue;





From: sailorsea21 sailorse...@yahoo.com
To: flexcoders@yahoogroups.com
Sent: Thursday, April 16, 2009 11:56:01 AM
Subject: [flexcoders] How can I receive the smallest value within an Array?





Hi everyone, if I have an array as

var boxSize:Array = new Array(25, 45, 32, 70, 50, 46, 80, 10);

Is there a function that will return me the smallest value within that array?

Thanks.

-David





  

Re: [flexcoders] How can I receive the smallest value within an Array?

2009-04-16 Thread Paul Andrews
Just for the future, most people would do this:

for ( var i:int =1; iarray.length; i++)

  - Original Message - 
  From: - - 
  To: flexcoders@yahoogroups.com 
  Sent: Thursday, April 16, 2009 5:06 PM
  Subject: Re: [flexcoders] How can I receive the smallest value within an 
Array?





  I got it:

  public function maxValue(array:Array):int

  {

  var value:int = array[0];

  var i:int = new int(0);

  for (i; iarray.length; i++) 

  { 

  if (array[i]value)

  { 

  value = array[i]; 

  } 

  } 

  return value;

  }


  public function minValue(array:Array):int

  {

  var value:int = array[0];

  var i:int = new int(0);

  for (i; iarray.length; i++) 

  { 

  if (array[i]value)

  { 

  value = array[i]; 

  } 

  } 

  return value;

  }






--
  From: sailorsea21 sailorse...@yahoo.com
  To: flexcoders@yahoogroups.com
  Sent: Thursday, April 16, 2009 11:56:01 AM
  Subject: [flexcoders] How can I receive the smallest value within an Array?


  Hi everyone, if I have an array as

  var boxSize:Array = new Array(25, 45, 32, 70, 50, 46, 80, 10);

  Is there a function that will return me the smallest value within that array?

  Thanks.

  -David







  

RE: [flexcoders] How can I receive the smallest value within an Array?

2009-04-16 Thread Jake Churchill
array = array.sort();

smallest = array[0];

 

Jake Churchill
CF Webtools
11204 Davenport, Ste. 100
Omaha, NE  68154
 http://www.cfwebtools.com http://www.cfwebtools.com
402-408-3733 x103

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Paul Andrews
Sent: Thursday, April 16, 2009 11:44 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] How can I receive the smallest value within an
Array?

 






Just for the future, most people would do this:

 

for ( var i:int =1; iarray.length; i++)

 

- Original Message - 

From: - - mailto:sailorse...@yahoo.com  

To: flexcoders@yahoogroups.com 

Sent: Thursday, April 16, 2009 5:06 PM

Subject: Re: [flexcoders] How can I receive the smallest value within an
Array?

 

I got it:

 

public function maxValue(array:Array):int

{

var value:int = array[0];

var i:int = new int(0);

for (i; iarray.length; i++) 

{ 

if (array[i]value)

{ 

value = array[i]; 

} 

} 

return value;

}

public function minValue(array:Array):int

{

var value:int = array[0];

var i:int = new int(0);

for (i; iarray.length; i++) 

{ 

if (array[i]value)

{ 

value = array[i]; 

} 

} 

return value;

}

 

 


  _  


From: sailorsea21 sailorse...@yahoo.com
To: flexcoders@yahoogroups.com
Sent: Thursday, April 16, 2009 11:56:01 AM
Subject: [flexcoders] How can I receive the smallest value within an Array?

Hi everyone, if I have an array as

var boxSize:Array = new Array(25, 45, 32, 70, 50, 46, 80, 10);

Is there a function that will return me the smallest value within that
array?

Thanks.

-David

 



No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.287 / Virus Database: 270.11.58/2062 - Release Date: 04/16/09
08:12:00



Re: [flexcoders] How can I receive the smallest value within an Array?

2009-04-16 Thread - -
Thanks Paul!





From: Paul Andrews p...@ipauland.com
To: flexcoders@yahoogroups.com
Sent: Thursday, April 16, 2009 12:44:18 PM
Subject: Re: [flexcoders] How can I receive the smallest value within an Array?





Just for the future, most people would do this:
 
for( var i:int =1; iarray.length; i++)
 
- Original Message - 
From: - - 
To: flexcod...@yahoogro ups.com 
Sent: Thursday, April 16, 2009 5:06 PM
Subject: Re: [flexcoders] How can I receive the smallest value within an Array?

I got it:

public
{
{ 
{ 
value = array[i]; 
} 
} 
}functionmaxValue(array: Array):intvarvalue:int = array[0];vari:int = 
newint(0);for(i; iarray.length; i++) if(array[i]value)returnvalue;public
{
{ 
{ 
value = array[i]; 
} 
} 
}functionminValue(array: Array):intvarvalue:int = array[0];vari:int = 
newint(0);for(i; iarray.length; i++) if(array[i]value)returnvalue;





From: sailorsea21 sailorsea21@ yahoo.com
To: flexcod...@yahoogro ups.com
Sent: Thursday, April 16, 2009 11:56:01 AM
Subject: [flexcoders] How can I receive the smallest value within an Array?


Hi everyone, if I have an array as

var boxSize:Array = new Array(25, 45, 32, 70, 50, 46, 80, 10);

Is there a function that will return me the smallest value within that array?

Thanks.

-David






  

RE: [flexcoders] How can I receive the smallest value within an Array?

2009-04-16 Thread Tracy Spratt
I bet the for-loop solution will be faster, since it need to process the
array only once.  Sorts require more passes, and performance is usually
subject to the initial order.

 

Tracy Spratt,

Lariat Services, development services available

  _  

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Jake Churchill
Sent: Thursday, April 16, 2009 1:27 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] How can I receive the smallest value within an
Array?

 






array = array.sort();

smallest = array[0];

 

Jake Churchill
CF Webtools
11204 Davenport, Ste. 100
Omaha, NE  68154
 http://www.cfwebtools.com http://www.cfwebtools.com
402-408-3733 x103

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Paul Andrews
Sent: Thursday, April 16, 2009 11:44 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] How can I receive the smallest value within an
Array?

 







Just for the future, most people would do this:

 

for ( var i:int =1; iarray.length; i++)

 

- Original Message - 

From: - - mailto:sailorse...@yahoo.com  

To: flexcod...@yahoogro mailto:flexcoders@yahoogroups.com ups.com 

Sent: Thursday, April 16, 2009 5:06 PM

Subject: Re: [flexcoders] How can I receive the smallest value within an
Array?

 

I got it:

 

public function maxValue(array:Array):int

{

var value:int = array[0];

var i:int = new int(0);

for (i; iarray.length; i++) 

{ 

if (array[i]value)

{ 

value = array[i]; 

} 

} 

return value;

}

public function minValue(array:Array):int

{

var value:int = array[0];

var i:int = new int(0);

for (i; iarray.length; i++) 

{ 

if (array[i]value)

{ 

value = array[i]; 

} 

} 

return value;

}

 

 


  _  


From: sailorsea21 sailorse...@yahoo.com
To: flexcoders@yahoogroups.com
Sent: Thursday, April 16, 2009 11:56:01 AM
Subject: [flexcoders] How can I receive the smallest value within an Array?

Hi everyone, if I have an array as

var boxSize:Array = new Array(25, 45, 32, 70, 50, 46, 80, 10);

Is there a function that will return me the smallest value within that
array?

Thanks.

-David

 

No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.287 / Virus Database: 270.11.58/2062 - Release Date: 04/16/09
08:12:00





RE: [flexcoders] How can I receive the smallest value within an Array?

2009-04-16 Thread Tracy Spratt
Be aware that if you have two loops in a function and use this syntax, you
will get a duplicate variable definition warning.

 

Tracy Spratt,

Lariat Services, development services available

  _  

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of - -
Sent: Thursday, April 16, 2009 1:39 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] How can I receive the smallest value within an
Array?

 






Thanks Paul!

 

  _  

From: Paul Andrews p...@ipauland.com
To: flexcoders@yahoogroups.com
Sent: Thursday, April 16, 2009 12:44:18 PM
Subject: Re: [flexcoders] How can I receive the smallest value within an
Array?

Just for the future, most people would do this:

 

for ( var i:int =1; iarray.length; i++)

 

- Original Message - 

From: - - mailto:sailorse...@yahoo.com  

To: flexcod...@yahoogro mailto:flexcoders@yahoogroups.com  ups.com 

Sent: Thursday, April 16, 2009 5:06 PM

Subject: Re: [flexcoders] How can I receive the smallest value within an
Array?

 

I got it:

 

public function maxValue(array: Array):int

{

var value:int = array[0];

var i:int = new int(0);

for (i; iarray.length; i++) 

{ 

if (array[i]value)

{ 

value = array[i]; 

} 

} 

return value;

}

public function minValue(array: Array):int

{

var value:int = array[0];

var i:int = new int(0);

for (i; iarray.length; i++) 

{ 

if (array[i]value)

{ 

value = array[i]; 

} 

} 

return value;

}

 

 


  _  


From: sailorsea21 sailorsea21@ yahoo.com http://yahoo.com/ 
To: flexcod...@yahoogro ups.com http://ups.com/ 
Sent: Thursday, April 16, 2009 11:56:01 AM
Subject: [flexcoders] How can I receive the smallest value within an Array?

Hi everyone, if I have an array as

var boxSize:Array = new Array(25, 45, 32, 70, 50, 46, 80, 10);

Is there a function that will return me the smallest value within that
array?

Thanks.

-David

 

 





Re: [flexcoders] How can I receive the smallest value within an Array?

2009-04-16 Thread - -
Thanks Tracy.





From: Tracy Spratt tspr...@lariatinc.com
To: flexcoders@yahoogroups.com
Sent: Thursday, April 16, 2009 3:39:35 PM
Subject: RE: [flexcoders] How can I receive the smallest value within an Array?





Be aware that if you have two loops in a function and use this syntax, you will 
get a duplicate variable definition warning.
 
Tracy Spratt,
Lariat Services, development services available



From:flexcod...@yahoogro ups.com [mailto: flexcod...@yahoogro ups.com ] On 
Behalf Of - -
Sent: Thursday, April 16, 2009 1:39 PM
To: flexcod...@yahoogro ups.com
Subject: Re: [flexcoders] How can I receive the smallest value within an Array?
 




Thanks Paul!
 



From:Paul Andrews p...@ipauland. com
To: flexcod...@yahoogro ups.com
Sent: Thursday, April 16, 2009 12:44:18 PM
Subject: Re: [flexcoders] How can I receive the smallest value within an Array?
Just for the future, most people would do this:
 
for( var i:int =1; iarray.length; i++)
 
- Original Message - 
From:- - 
To:flexcod...@yahoogro ups.com 
Sent:Thursday, April 16, 2009 5:06 PM
Subject:Re: [flexcoders] How can I receive the smallest value within an Array?
 
I got it:
 
publicfunction maxValue(array: Array):int
{
varvalue:int = array[0];
vari:int = new int(0);
for(i; iarray.length; i++) 
{ 
if(array[i]value)
{ 
value = array[i]; 
} 
} 
returnvalue;
}
publicfunction minValue(array: Array):int
{
varvalue:int = array[0];
vari:int = new int(0);
for(i; iarray.length; i++) 
{ 
if(array[i]value)
{ 
value = array[i]; 
} 
} 
returnvalue;
}
 
 



From:sailorsea21 sailorsea21@ yahoo.com
To: flexcod...@yahoogro ups.com
Sent: Thursday, April 16, 2009 11:56:01 AM
Subject: [flexcoders] How can I receive the smallest value within an Array?
Hi everyone, if I have an array as

var boxSize:Array = new Array(25, 45, 32, 70, 50, 46, 80, 10);

Is there a function that will return me the smallest value within that array?

Thanks.

-David
 
 



  

Re: [flexcoders] How can I receive the smallest value within an Array?

2009-04-16 Thread f3l
why not get the max from SQL (sisn't that where your data comes from in the
first place?)

On Thu, Apr 16, 2009 at 2:39 PM, Tracy Spratt tspr...@lariatinc.com wrote:



  Be aware that if you have two loops in a function and use this syntax,
 you will get a duplicate variable definition warning.



 Tracy Spratt,

 Lariat Services, development services available
   --

 *From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] *On
 Behalf Of *- -
 *Sent:* Thursday, April 16, 2009 1:39 PM
 *To:* flexcoders@yahoogroups.com

 *Subject:* Re: [flexcoders] How can I receive the smallest value within an
 Array?






   Thanks Paul!


  --

 *From:* Paul Andrews p...@ipauland.com
 *To:* flexcoders@yahoogroups.com
 *Sent:* Thursday, April 16, 2009 12:44:18 PM
 *Subject:* Re: [flexcoders] How can I receive the smallest value within an
 Array?

 Just for the future, most people would do this:



 *for* ( var i:int =1; iarray.length; i++)



  - Original Message -

 *From:* - - sailorse...@yahoo.com

 *To:* flexcod...@yahoogro ups.com flexcoders@yahoogroups.com

 *Sent:* Thursday, April 16, 2009 5:06 PM

 *Subject:* Re: [flexcoders] How can I receive the smallest value within an
 Array?



 I got it:



 *public* *function* maxValue(array: Array):int

 {

 *var* value:int = array[0];

 *var* i:int = *new* int(0);

 *for* (i; iarray.length; i++)

 {

 *if* (array[i]value)

 {

 value = array[i];

 }

 }

 *return* value;

 }

 *public* *function* minValue(array: Array):int

 {

 *var* value:int = array[0];

 *var* i:int = *new* int(0);

 *for* (i; iarray.length; i++)

 {

 *if* (array[i]value)

 {

 value = array[i];

 }

 }

 *return* value;

 }




  --

 *From:* sailorsea21 sailorsea21@ yahoo.com
 *To:* flexcod...@yahoogro ups.com
 *Sent:* Thursday, April 16, 2009 11:56:01 AM
 *Subject:* [flexcoders] How can I receive the smallest value within an
 Array?

 Hi everyone, if I have an array as

 var boxSize:Array = new Array(25, 45, 32, 70, 50, 46, 80, 10);

 Is there a function that will return me the smallest value within that
 array?

 Thanks.

 -David





  




-- 
What a Great Day*
http://whatagreatday.wordpress.com/


Re: [flexcoders] How can I receive the smallest value within an Array?

2009-04-16 Thread - -
It will but at the moment I'm putting together a quick demo.

Thanks!





From: f3l auditor...@gmail.com
To: flexcoders@yahoogroups.com
Sent: Thursday, April 16, 2009 3:47:47 PM
Subject: Re: [flexcoders] How can I receive the smallest value within an Array?





why not get the max from SQL (sisn't that where your data comes from in the 
first place?) 



On Thu, Apr 16, 2009 at 2:39 PM, Tracy Spratt tspr...@lariatinc. com wrote:




Be aware that if you have two loops in a function and use this syntax, you will 
get a duplicate variable definition warning.
 
Tracy Spratt,
Lariat Services, development services available



From:flexcod...@yahoogro ups.com [mailto:flexcod...@yahoogro ups.com] On Behalf 
Of - -
Sent: Thursday, April 16, 2009 1:39 PM
To: flexcod...@yahoogro ups.com 

Subject: Re: [flexcoders] How can I receive the smallest value within an Array?
 




Thanks Paul!
 



From:Paul Andrews p...@ipauland. com
To: flexcod...@yahoogro ups.com
Sent: Thursday, April 16, 2009 12:44:18 PM
Subject: Re: [flexcoders] How can I receive the smallest value within an Array?
Just for the future, most people would do this:
 
for( var i:int =1; iarray.length; i++)
 
- Original Message - 
From:- - 
To:flexcod...@yahoogro ups.com 
Sent:Thursday, April 16, 2009 5:06 PM
Subject:Re: [flexcoders] How can I receive the smallest value within an Array?
 
I got it:
 
publicfunction maxValue(array: Array):int
{
varvalue:int = array[0];
vari:int = new int(0);
for(i; iarray.length; i++) 
{ 
if(array[i]value)
{ 
value = array[i]; 
} 
} 
returnvalue;
}
publicfunction minValue(array: Array):int
{
varvalue:int = array[0];
vari:int = new int(0);
for(i; iarray.length; i++) 
{ 
if(array[i]value)
{ 
value = array[i]; 
} 
} 
returnvalue;
}
 
 



From:sailorsea21 sailorsea21@ yahoo.com
To: flexcod...@yahoogro ups.com
Sent: Thursday, April 16, 2009 11:56:01 AM
Subject: [flexcoders] How can I receive the smallest value within an Array?
Hi everyone, if I have an array as

var boxSize:Array = new Array(25, 45, 32, 70, 50, 46, 80, 10);

Is there a function that will return me the smallest value within that array?

Thanks.

-David
 
 


-- 
What a Great Day*
http://whatagreatda y.wordpress. com/