Re: [flexcoders] Re: simple array?

2009-05-22 Thread Charles Parcell
Why even have the Array aspect in the second example? It stands as a
pointless container for what we are seeing it used for. Unless there will be
some additional items added to it that we have not seen yet.

I just feel the need to point that out. :)

Charles P.


On Thu, May 21, 2009 at 3:49 PM, Eric Cooper e...@cooper.nu wrote:

 I just tried compiling what I wrote - and realized that it didn't... so
 here are two variants. The first is same as previous, but it compiles. The
 second may be more in the spirit of what you were attempting initially - and
 kind of highlights similarities between arrays and objects.

 First:

var records:Array = new Array(
{ code:AC, text:Remember to reset
 the station address. },
{ code:RN, text:Remember to reset
 the station expiration date. },
{ code:CP, text:Remember to
 contact contractor to remove the certificates from this station. },
{ code:CR, text:Remember to
 cancel the refund payment. }
);

 for each (var test:Object in records) {
if
 (grid.selectedItem.PAYMENT_TYPE_CODE == test.code)
Alert.show(test.text );
}


 Second:

var PAYMENT_TYPE_CODE:String = CR;
 var records:Array = new Array(
{ AC: Remember to reset the
 station address. },
{ RN: Remember to reset the
 station expiration date. },
{ CP: Remember to contact
 contractor to remove the certificates from this station. },
{ CR: Remember to cancel the
 refund payment. }
);

 for (var i:int = 0; i  records.length;
 ++i) {
if
 (records[i][grid.selectedItem.PAYMENT_TYPE_CODE])

  Alert.show(records[i][PAYMENT_TYPE_CODE]);
 }




 --- In flexcoders@yahoogroups.com, Jason B nos...@... wrote:
 
  SWEET thanks
 
  --- In flexcoders@yahoogroups.com, Eric Cooper eric@ wrote:
  
   How about this:
  
   var records:Array = new Array(
   { code:AC, text:Remember to
 reset the station address. },
   { code:RN, text:Remember to
 reset the station expiration date. },
   { code:CP, text:Remember to
 contact contractor to remove the certificates from this station. },
   { code:CR, text:Remember to
 cancel the refund payment. },
   );
  
   for each(test:Object in records){
   if(grid.selectedItem.PAYMENT_TYPE_CODE == test[i].code)
   Alert.show(test[i].text );
   }
  
   would that do it?
  
   -eric
  
   --- In flexcoders@yahoogroups.com, Jason B nospam@ wrote:
   
var records:Array = new Array({
  AC: Remember to reset the station address.,
  RN: Remember to reset the station expiration
 date.,
  CP: Remember to contact contractor to remove the
 certificates from this station.,
  CR: Remember to cancel the refund payment.
  });
   
   
for each(test:Object in records){
   
//HERE we match up PAYMENT TYPE CODE with AC RN CP if one is a match
 we show the value
   
if(grid.selectedItem.PAYMENT_TYPE_CODE == test[i])
 Alert.show(SHOW ME ---Remember to reset the station address );
   
   
   
}
   
   
datagrid hidden column AC, RN, CP are in datagrid
user selects RT item from grid and hits button
system match's that row with what message should be displayed
user never see's RT since its a hidden field in grid
user now see's a message displayed as a reminder
   
   
   
   
   
   
   
--- In flexcoders@yahoogroups.com, Paul Andrews paul@ wrote:

 Jason,

 I'm not sure I follow exactly what the problem is now.

 Paul
 - Original Message -
 From: Jason B nospam@
 To: flexcoders@yahoogroups.com
 Sent: Thursday, May 21, 2009 4:02 PM
 Subject: [flexcoders] Re: simple array?


 i want to loop the records and compare the value addresschange
 to the
 PAYMENT Type Code if its the right one display it
 
 
  --- In flexcoders@yahoogroups.com, Paul Andrews paul@ wrote:
 
 
  - Original Message -
  From: Jason B nospam@
  To: flexcoders@yahoogroups.com
  Sent: Thursday, May 21, 2009 3:46 PM
  Subject: [flexcoders] Re

Re: [flexcoders] Re: simple array?

2009-05-22 Thread Charles Parcell
Additionally, utilizing a loop to locate an item can eat up cycles if the
list of codes gets to be large.  Granted that in the case of this example
looping 3 or even 10 items is likely not going to be an issue in anyway.
Something to think about if the application of this example is used
differently.

Charles P.


On Fri, May 22, 2009 at 10:50 AM, Charles Parcell
pokemonkil...@gmail.comwrote:

 Why even have the Array aspect in the second example? It stands as a
 pointless container for what we are seeing it used for. Unless there will be
 some additional items added to it that we have not seen yet.

 I just feel the need to point that out. :)

 Charles P.



 On Thu, May 21, 2009 at 3:49 PM, Eric Cooper e...@cooper.nu wrote:

 I just tried compiling what I wrote - and realized that it didn't... so
 here are two variants. The first is same as previous, but it compiles. The
 second may be more in the spirit of what you were attempting initially - and
 kind of highlights similarities between arrays and objects.

 First:

var records:Array = new Array(
{ code:AC, text:Remember to
 reset the station address. },
{ code:RN, text:Remember to
 reset the station expiration date. },
{ code:CP, text:Remember to
 contact contractor to remove the certificates from this station. },
{ code:CR, text:Remember to
 cancel the refund payment. }
);

 for each (var test:Object in records) {
if
 (grid.selectedItem.PAYMENT_TYPE_CODE == test.code)
Alert.show(test.text );
}


 Second:

var PAYMENT_TYPE_CODE:String = CR;
 var records:Array = new Array(
{ AC: Remember to reset the
 station address. },
{ RN: Remember to reset the
 station expiration date. },
{ CP: Remember to contact
 contractor to remove the certificates from this station. },
{ CR: Remember to cancel the
 refund payment. }
);

 for (var i:int = 0; i  records.length;
 ++i) {
if
 (records[i][grid.selectedItem.PAYMENT_TYPE_CODE])

  Alert.show(records[i][PAYMENT_TYPE_CODE]);
 }




 --- In flexcoders@yahoogroups.com, Jason B nos...@... wrote:
 
  SWEET thanks
 
  --- In flexcoders@yahoogroups.com, Eric Cooper eric@ wrote:
  
   How about this:
  
   var records:Array = new Array(
   { code:AC, text:Remember to
 reset the station address. },
   { code:RN, text:Remember to
 reset the station expiration date. },
   { code:CP, text:Remember to
 contact contractor to remove the certificates from this station. },
   { code:CR, text:Remember to
 cancel the refund payment. },
   );
  
   for each(test:Object in records){
   if(grid.selectedItem.PAYMENT_TYPE_CODE == test[i].code)
   Alert.show(test[i].text );
   }
  
   would that do it?
  
   -eric
  
   --- In flexcoders@yahoogroups.com, Jason B nospam@ wrote:
   
var records:Array = new Array({
  AC: Remember to reset the station address.,
  RN: Remember to reset the station expiration
 date.,
  CP: Remember to contact contractor to remove
 the certificates from this station.,
  CR: Remember to cancel the refund payment.
  });
   
   
for each(test:Object in records){
   
//HERE we match up PAYMENT TYPE CODE with AC RN CP if one is a match
 we show the value
   
if(grid.selectedItem.PAYMENT_TYPE_CODE == test[i])
 Alert.show(SHOW ME ---Remember to reset the station address );
   
   
   
}
   
   
datagrid hidden column AC, RN, CP are in datagrid
user selects RT item from grid and hits button
system match's that row with what message should be displayed
user never see's RT since its a hidden field in grid
user now see's a message displayed as a reminder
   
   
   
   
   
   
   
--- In flexcoders@yahoogroups.com, Paul Andrews paul@ wrote:

 Jason,

 I'm not sure I follow exactly what the problem is now.

 Paul
 - Original Message -
 From: Jason B nospam@
 To: flexcoders@yahoogroups.com
 Sent: Thursday, May 21, 2009 4:02 PM
 Subject: [flexcoders] Re: simple array

[flexcoders] Re: simple array?

2009-05-22 Thread Eric Cooper
 );
}
   
would that do it?
   
-eric
   
--- In flexcoders@yahoogroups.com, Jason B nospam@ wrote:

 var records:Array = new Array({
   AC: Remember to reset the station address.,
   RN: Remember to reset the station expiration
  date.,
   CP: Remember to contact contractor to remove
  the certificates from this station.,
   CR: Remember to cancel the refund payment.
   });


 for each(test:Object in records){

 //HERE we match up PAYMENT TYPE CODE with AC RN CP if one is a match
  we show the value

 if(grid.selectedItem.PAYMENT_TYPE_CODE == test[i])
  Alert.show(SHOW ME ---Remember to reset the station address );



 }


 datagrid hidden column AC, RN, CP are in datagrid
 user selects RT item from grid and hits button
 system match's that row with what message should be displayed
 user never see's RT since its a hidden field in grid
 user now see's a message displayed as a reminder







 --- In flexcoders@yahoogroups.com, Paul Andrews paul@ wrote:
 
  Jason,
 
  I'm not sure I follow exactly what the problem is now.
 
  Paul
  - Original Message -
  From: Jason B nospam@
  To: flexcoders@yahoogroups.com
  Sent: Thursday, May 21, 2009 4:02 PM
  Subject: [flexcoders] Re: simple array?
 
 
  i want to loop the records and compare the value addresschange
  to the
  PAYMENT Type Code if its the right one display it
  
  
   --- In flexcoders@yahoogroups.com, Paul Andrews paul@
  wrote:
  
  
   - Original Message -
   From: Jason B nospam@
   To: flexcoders@yahoogroups.com
   Sent: Thursday, May 21, 2009 3:46 PM
   Subject: [flexcoders] Re: simple array?
  
  
Thanks but i dont know how to do a compare based on your
  example show?
  
for(var i:uint = 0; i  records.length; i++) {
//If array matchs show text
   if(payment_grid.selectedItem.PAYMENT_TYPE_CODE ==
   records[i].addresschange){
   Alert.show(records[i].addresschange);
   }
   }
  
  
   
   
for(var i:uint = 0; i  records.length; i++) {
//If array matchs show text
if(payment_grid.selectedItem.PAYMENT_TYPE_CODE ==
  records.valueof
){
   Alert.show(records[0].addresschange);
   
}
   
   
   
--- In flexcoders@yahoogroups.com, Pedro Sena sena.pedro@
  wrote:
   
records[0].addresschange
   
You are putting an object inside your array
   
Using records[0] you retrieve your object
using records[0].addresschange you access its property
  called
addresschange
   
On Thu, May 21, 2009 at 11:14 AM, Jason B nospam@ wrote:
   


 var records:Array = new Array({
 addresschange: Remember to reset the station address.,
 etc.
 });


 Alert.show(records['addresschange']);
 Alert.show(records[0]);
 Alert.show(records.addresschange);

 how the heck can i access the item directly by index name?



   
   
   
--
/**
* Pedro Sena
* Systems Architect
* Sun Certified Java Programmer
* Sun Certified Web Component Developer
*/
   
   
   
   
   

   
--
Flexcoders Mailing List
FAQ:
  http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Alternative FAQ location:
   
  https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
Search Archives:
   
  http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
Links
   
   
   
  
  
  
  
  
   
  
   --
   Flexcoders Mailing List
   FAQ:
  http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
   Alternative FAQ location:
  
  https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
   Search Archives:
   http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo!
  Groups
   Links
  
  
  
 

   
  
 
 
 
 
  
 
  --
  Flexcoders Mailing List
  FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
  Alternative FAQ location:
  https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
  Search Archives:
  http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
  Links
 
 
 
 
 





[flexcoders] Re: simple array?

2009-05-22 Thread Eric Cooper
 to reset the station expiration
  date.,
   CP: Remember to contact contractor to remove
  the certificates from this station.,
   CR: Remember to cancel the refund payment.
   });


 for each(test:Object in records){

 //HERE we match up PAYMENT TYPE CODE with AC RN CP if one is a match
  we show the value

 if(grid.selectedItem.PAYMENT_TYPE_CODE == test[i])
  Alert.show(SHOW ME ---Remember to reset the station address );



 }


 datagrid hidden column AC, RN, CP are in datagrid
 user selects RT item from grid and hits button
 system match's that row with what message should be displayed
 user never see's RT since its a hidden field in grid
 user now see's a message displayed as a reminder







 --- In flexcoders@yahoogroups.com, Paul Andrews paul@ wrote:
 
  Jason,
 
  I'm not sure I follow exactly what the problem is now.
 
  Paul
  - Original Message -
  From: Jason B nospam@
  To: flexcoders@yahoogroups.com
  Sent: Thursday, May 21, 2009 4:02 PM
  Subject: [flexcoders] Re: simple array?
 
 
  i want to loop the records and compare the value addresschange
  to the
  PAYMENT Type Code if its the right one display it
  
  
   --- In flexcoders@yahoogroups.com, Paul Andrews paul@
  wrote:
  
  
   - Original Message -
   From: Jason B nospam@
   To: flexcoders@yahoogroups.com
   Sent: Thursday, May 21, 2009 3:46 PM
   Subject: [flexcoders] Re: simple array?
  
  
Thanks but i dont know how to do a compare based on your
  example show?
  
for(var i:uint = 0; i  records.length; i++) {
//If array matchs show text
   if(payment_grid.selectedItem.PAYMENT_TYPE_CODE ==
   records[i].addresschange){
   Alert.show(records[i].addresschange);
   }
   }
  
  
   
   
for(var i:uint = 0; i  records.length; i++) {
//If array matchs show text
if(payment_grid.selectedItem.PAYMENT_TYPE_CODE ==
  records.valueof
){
   Alert.show(records[0].addresschange);
   
}
   
   
   
--- In flexcoders@yahoogroups.com, Pedro Sena sena.pedro@
  wrote:
   
records[0].addresschange
   
You are putting an object inside your array
   
Using records[0] you retrieve your object
using records[0].addresschange you access its property
  called
addresschange
   
On Thu, May 21, 2009 at 11:14 AM, Jason B nospam@ wrote:
   


 var records:Array = new Array({
 addresschange: Remember to reset the station address.,
 etc.
 });


 Alert.show(records['addresschange']);
 Alert.show(records[0]);
 Alert.show(records.addresschange);

 how the heck can i access the item directly by index name?



   
   
   
--
/**
* Pedro Sena
* Systems Architect
* Sun Certified Java Programmer
* Sun Certified Web Component Developer
*/
   
   
   
   
   

   
--
Flexcoders Mailing List
FAQ:
  http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Alternative FAQ location:
   
  https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
Search Archives:
   
  http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
Links
   
   
   
  
  
  
  
  
   
  
   --
   Flexcoders Mailing List
   FAQ:
  http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
   Alternative FAQ location:
  
  https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
   Search Archives:
   http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo!
  Groups
   Links
  
  
  
 

   
  
 
 
 
 
  
 
  --
  Flexcoders Mailing List
  FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
  Alternative FAQ location:
  https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
  Search Archives:
  http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
  Links
 
 
 
 
 





Re: [flexcoders] Re: simple array?

2009-05-22 Thread Charles Parcell
. },
 { code:CP, text:Remember to
   contact contractor to remove the certificates from this station. },
 { code:CR, text:Remember to
   cancel the refund payment. },
 );

 for each(test:Object in records){
 if(grid.selectedItem.PAYMENT_TYPE_CODE == test[i].code)
 Alert.show(test[i].text );
 }

 would that do it?

 -eric

 --- In flexcoders@yahoogroups.com, Jason B nospam@ wrote:
 
  var records:Array = new Array({
AC: Remember to reset the station
 address.,
RN: Remember to reset the station
 expiration
   date.,
CP: Remember to contact contractor to
 remove
   the certificates from this station.,
CR: Remember to cancel the refund payment.
});
 
 
  for each(test:Object in records){
 
  //HERE we match up PAYMENT TYPE CODE with AC RN CP if one is a
 match
   we show the value
 
  if(grid.selectedItem.PAYMENT_TYPE_CODE == test[i])
   Alert.show(SHOW ME ---Remember to reset the station address
 );
 
 
 
  }
 
 
  datagrid hidden column AC, RN, CP are in datagrid
  user selects RT item from grid and hits button
  system match's that row with what message should be displayed
  user never see's RT since its a hidden field in grid
  user now see's a message displayed as a reminder
 
 
 
 
 
 
 
  --- In flexcoders@yahoogroups.com, Paul Andrews paul@
 wrote:
  
   Jason,
  
   I'm not sure I follow exactly what the problem is now.
  
   Paul
   - Original Message -
   From: Jason B nospam@
   To: flexcoders@yahoogroups.com
   Sent: Thursday, May 21, 2009 4:02 PM
   Subject: [flexcoders] Re: simple array?
  
  
   i want to loop the records and compare the value
 addresschange
   to the
   PAYMENT Type Code if its the right one display it
   
   
--- In flexcoders@yahoogroups.com, Paul Andrews paul@
   wrote:
   
   
- Original Message -
From: Jason B nospam@
To: flexcoders@yahoogroups.com
Sent: Thursday, May 21, 2009 3:46 PM
Subject: [flexcoders] Re: simple array?
   
   
 Thanks but i dont know how to do a compare based on your
   example show?
   
 for(var i:uint = 0; i  records.length; i++) {
 //If array matchs show text
if(payment_grid.selectedItem.PAYMENT_TYPE_CODE ==
records[i].addresschange){
Alert.show(records[i].addresschange);
}
}
   
   


 for(var i:uint = 0; i  records.length; i++) {
 //If array matchs show text
 if(payment_grid.selectedItem.PAYMENT_TYPE_CODE ==
   records.valueof
 ){
Alert.show(records[0].addresschange);

 }



 --- In flexcoders@yahoogroups.com, Pedro Sena
 sena.pedro@
   wrote:

 records[0].addresschange

 You are putting an object inside your array

 Using records[0] you retrieve your object
 using records[0].addresschange you access its property
   called
 addresschange

 On Thu, May 21, 2009 at 11:14 AM, Jason B nospam@
 wrote:

 
 
  var records:Array = new Array({
  addresschange: Remember to reset the station
 address.,
  etc.
  });
 
 
  Alert.show(records['addresschange']);
  Alert.show(records[0]);
  Alert.show(records.addresschange);
 
  how the heck can i access the item directly by index
 name?
 
 
 



 --
 /**
 * Pedro Sena
 * Systems Architect
 * Sun Certified Java Programmer
 * Sun Certified Web Component Developer
 */





 

 --
 Flexcoders Mailing List
 FAQ:
   http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
 Alternative FAQ location:

  
 https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
 Search Archives:

   http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
 Links



   
   
   
   
   

   
--
Flexcoders Mailing List
FAQ:
   http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Alternative FAQ location:
   
  
 https://share.acrobat.com/adc/document.do

[flexcoders] Re: simple array?

2009-05-21 Thread Jason B
Thanks but i dont know how to do a compare based on your example show?


for(var i:uint = 0; i  records.length; i++) {
//If array matchs show text 
if(payment_grid.selectedItem.PAYMENT_TYPE_CODE == records.valueof ){
 Alert.show(records[0].addresschange);  


}



--- In flexcoders@yahoogroups.com, Pedro Sena sena.pe...@... wrote:

 records[0].addresschange
 
 You are putting an object inside your array
 
 Using records[0] you retrieve your object
 using records[0].addresschange you access its property called addresschange
 
 On Thu, May 21, 2009 at 11:14 AM, Jason B nos...@... wrote:
 
 
 
  var records:Array = new Array({
  addresschange: Remember to reset the station address.,
  etc.
  });
 
 
  Alert.show(records['addresschange']);
  Alert.show(records[0]);
  Alert.show(records.addresschange);
 
  how the heck can i access the item directly by index name?
 
   
 
 
 
 
 -- 
 /**
 * Pedro Sena
 * Systems Architect
 * Sun Certified Java Programmer
 * Sun Certified Web Component Developer
 */





Re: [flexcoders] Re: simple array?

2009-05-21 Thread Paul Andrews

- Original Message - 
From: Jason B nos...@advancedonsite.com
To: flexcoders@yahoogroups.com
Sent: Thursday, May 21, 2009 3:46 PM
Subject: [flexcoders] Re: simple array?


 Thanks but i dont know how to do a compare based on your example show?

 for(var i:uint = 0; i  records.length; i++) {
 //If array matchs show text
if(payment_grid.selectedItem.PAYMENT_TYPE_CODE == 
records[i].addresschange){
Alert.show(records[i].addresschange);
}
}




 for(var i:uint = 0; i  records.length; i++) {
 //If array matchs show text 
 if(payment_grid.selectedItem.PAYMENT_TYPE_CODE == records.valueof ){
Alert.show(records[0].addresschange);

 }



 --- In flexcoders@yahoogroups.com, Pedro Sena sena.pe...@... wrote:

 records[0].addresschange

 You are putting an object inside your array

 Using records[0] you retrieve your object
 using records[0].addresschange you access its property called 
 addresschange

 On Thu, May 21, 2009 at 11:14 AM, Jason B nos...@... wrote:

 
 
  var records:Array = new Array({
  addresschange: Remember to reset the station address.,
  etc.
  });
 
 
  Alert.show(records['addresschange']);
  Alert.show(records[0]);
  Alert.show(records.addresschange);
 
  how the heck can i access the item directly by index name?
 
 
 



 -- 
 /**
 * Pedro Sena
 * Systems Architect
 * Sun Certified Java Programmer
 * Sun Certified Web Component Developer
 */





 

 --
 Flexcoders Mailing List
 FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
 Alternative FAQ location: 
 https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
 Search Archives: 
 http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups 
 Links






Re: [flexcoders] Re: simple array?

2009-05-21 Thread Pedro Sena
I didn't get it.

records[i],addresschange would do what I'm thinking, but I don't know if I
understood correctly


On Thu, May 21, 2009 at 11:46 AM, Jason B nos...@advancedonsite.com wrote:



 Thanks but i dont know how to do a compare based on your example show?

 for(var i:uint = 0; i  records.length; i++) {
 //If array matchs show text if(payment_grid.selectedItem.PAYMENT_TYPE_CODE
 == records.valueof ){
 Alert.show(records[0].addresschange);

 }

 --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Pedro
 Sena sena.pe...@... wrote:
 
  records[0].addresschange
 
  You are putting an object inside your array
 
  Using records[0] you retrieve your object
  using records[0].addresschange you access its property called
 addresschange
 
  On Thu, May 21, 2009 at 11:14 AM, Jason B nos...@... wrote:
 
  
  
   var records:Array = new Array({
   addresschange: Remember to reset the station address.,
   etc.
   });
  
  
   Alert.show(records['addresschange']);
   Alert.show(records[0]);
   Alert.show(records.addresschange);
  
   how the heck can i access the item directly by index name?
  
  
  
 
 
 
  --
  /**
  * Pedro Sena
  * Systems Architect
  * Sun Certified Java Programmer
  * Sun Certified Web Component Developer
  */
 

  




-- 
/**
* Pedro Sena
* Systems Architect
* Sun Certified Java Programmer
* Sun Certified Web Component Developer
*/


[flexcoders] Re: simple array?

2009-05-21 Thread Jason B
i want to loop the records and compare the value addresschange to the PAYMENT 
Type Code if its the right one display it


--- In flexcoders@yahoogroups.com, Paul Andrews p...@... wrote:

 
 - Original Message - 
 From: Jason B nos...@...
 To: flexcoders@yahoogroups.com
 Sent: Thursday, May 21, 2009 3:46 PM
 Subject: [flexcoders] Re: simple array?
 
 
  Thanks but i dont know how to do a compare based on your example show?
 
  for(var i:uint = 0; i  records.length; i++) {
  //If array matchs show text
 if(payment_grid.selectedItem.PAYMENT_TYPE_CODE == 
 records[i].addresschange){
 Alert.show(records[i].addresschange);
 }
 }
 
 
 
 
  for(var i:uint = 0; i  records.length; i++) {
  //If array matchs show text 
  if(payment_grid.selectedItem.PAYMENT_TYPE_CODE == records.valueof ){
 Alert.show(records[0].addresschange);
 
  }
 
 
 
  --- In flexcoders@yahoogroups.com, Pedro Sena sena.pedro@ wrote:
 
  records[0].addresschange
 
  You are putting an object inside your array
 
  Using records[0] you retrieve your object
  using records[0].addresschange you access its property called 
  addresschange
 
  On Thu, May 21, 2009 at 11:14 AM, Jason B nospam@ wrote:
 
  
  
   var records:Array = new Array({
   addresschange: Remember to reset the station address.,
   etc.
   });
  
  
   Alert.show(records['addresschange']);
   Alert.show(records[0]);
   Alert.show(records.addresschange);
  
   how the heck can i access the item directly by index name?
  
  
  
 
 
 
  -- 
  /**
  * Pedro Sena
  * Systems Architect
  * Sun Certified Java Programmer
  * Sun Certified Web Component Developer
  */
 
 
 
 
 
  
 
  --
  Flexcoders Mailing List
  FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
  Alternative FAQ location: 
  https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
  Search Archives: 
  http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups 
  Links
 
 
 





Re: [flexcoders] Re: simple array?

2009-05-21 Thread Paul Andrews
Jason,

I'm not sure I follow exactly what the problem is now.

Paul
- Original Message - 
From: Jason B nos...@advancedonsite.com
To: flexcoders@yahoogroups.com
Sent: Thursday, May 21, 2009 4:02 PM
Subject: [flexcoders] Re: simple array?


i want to loop the records and compare the value addresschange to the 
PAYMENT Type Code if its the right one display it


 --- In flexcoders@yahoogroups.com, Paul Andrews p...@... wrote:


 - Original Message - 
 From: Jason B nos...@...
 To: flexcoders@yahoogroups.com
 Sent: Thursday, May 21, 2009 3:46 PM
 Subject: [flexcoders] Re: simple array?


  Thanks but i dont know how to do a compare based on your example show?

  for(var i:uint = 0; i  records.length; i++) {
  //If array matchs show text
 if(payment_grid.selectedItem.PAYMENT_TYPE_CODE ==
 records[i].addresschange){
 Alert.show(records[i].addresschange);
 }
 }


 
 
  for(var i:uint = 0; i  records.length; i++) {
  //If array matchs show text
  if(payment_grid.selectedItem.PAYMENT_TYPE_CODE == records.valueof 
  ){
 Alert.show(records[0].addresschange);
 
  }
 
 
 
  --- In flexcoders@yahoogroups.com, Pedro Sena sena.pedro@ wrote:
 
  records[0].addresschange
 
  You are putting an object inside your array
 
  Using records[0] you retrieve your object
  using records[0].addresschange you access its property called
  addresschange
 
  On Thu, May 21, 2009 at 11:14 AM, Jason B nospam@ wrote:
 
  
  
   var records:Array = new Array({
   addresschange: Remember to reset the station address.,
   etc.
   });
  
  
   Alert.show(records['addresschange']);
   Alert.show(records[0]);
   Alert.show(records.addresschange);
  
   how the heck can i access the item directly by index name?
  
  
  
 
 
 
  -- 
  /**
  * Pedro Sena
  * Systems Architect
  * Sun Certified Java Programmer
  * Sun Certified Web Component Developer
  */
 
 
 
 
 
  
 
  --
  Flexcoders Mailing List
  FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
  Alternative FAQ location:
  https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
  Search Archives:
  http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
  Links
 
 
 





 

 --
 Flexcoders Mailing List
 FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
 Alternative FAQ location: 
 https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
 Search Archives: 
 http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups 
 Links






[flexcoders] Re: simple array?

2009-05-21 Thread Jason B
var records:Array = new Array({
AC: Remember to reset the station address., 
RN: Remember to reset the station expiration date.,
CP: Remember to contact contractor to remove the 
certificates from this station.,
CR: Remember to cancel the refund payment.
});


for each(test:Object in records){

//HERE we match up PAYMENT TYPE CODE with AC RN CP if one is a match we show 
the value  

if(grid.selectedItem.PAYMENT_TYPE_CODE == test[i])
 Alert.show(SHOW ME ---Remember to reset the station address );



}


datagrid hidden column AC, RN, CP are in datagrid
user selects RT item from grid and hits button
system match's that row with what message should be displayed
user never see's RT since its a hidden field in grid
user now see's a message displayed as a reminder







--- In flexcoders@yahoogroups.com, Paul Andrews p...@... wrote:

 Jason,
 
 I'm not sure I follow exactly what the problem is now.
 
 Paul
 - Original Message - 
 From: Jason B nos...@...
 To: flexcoders@yahoogroups.com
 Sent: Thursday, May 21, 2009 4:02 PM
 Subject: [flexcoders] Re: simple array?
 
 
 i want to loop the records and compare the value addresschange to the 
 PAYMENT Type Code if its the right one display it
 
 
  --- In flexcoders@yahoogroups.com, Paul Andrews paul@ wrote:
 
 
  - Original Message - 
  From: Jason B nospam@
  To: flexcoders@yahoogroups.com
  Sent: Thursday, May 21, 2009 3:46 PM
  Subject: [flexcoders] Re: simple array?
 
 
   Thanks but i dont know how to do a compare based on your example show?
 
   for(var i:uint = 0; i  records.length; i++) {
   //If array matchs show text
  if(payment_grid.selectedItem.PAYMENT_TYPE_CODE ==
  records[i].addresschange){
  Alert.show(records[i].addresschange);
  }
  }
 
 
  
  
   for(var i:uint = 0; i  records.length; i++) {
   //If array matchs show text
   if(payment_grid.selectedItem.PAYMENT_TYPE_CODE == records.valueof 
   ){
  Alert.show(records[0].addresschange);
  
   }
  
  
  
   --- In flexcoders@yahoogroups.com, Pedro Sena sena.pedro@ wrote:
  
   records[0].addresschange
  
   You are putting an object inside your array
  
   Using records[0] you retrieve your object
   using records[0].addresschange you access its property called
   addresschange
  
   On Thu, May 21, 2009 at 11:14 AM, Jason B nospam@ wrote:
  
   
   
var records:Array = new Array({
addresschange: Remember to reset the station address.,
etc.
});
   
   
Alert.show(records['addresschange']);
Alert.show(records[0]);
Alert.show(records.addresschange);
   
how the heck can i access the item directly by index name?
   
   
   
  
  
  
   -- 
   /**
   * Pedro Sena
   * Systems Architect
   * Sun Certified Java Programmer
   * Sun Certified Web Component Developer
   */
  
  
  
  
  
   
  
   --
   Flexcoders Mailing List
   FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
   Alternative FAQ location:
   https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
   Search Archives:
   http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
   Links
  
  
  
 
 
 
 
 
  
 
  --
  Flexcoders Mailing List
  FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
  Alternative FAQ location: 
  https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
  Search Archives: 
  http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups 
  Links
 
 
 





[flexcoders] Re: simple array?

2009-05-21 Thread valdhor
Try this:

var theRecords:Object = records[0];
var paymentTypeCode:String = grid.selectedItem.PAYMENT_TYPE_CODE;
if(theRecords.hasOwnProperty(paymentTypeCode))
{
 Alert.show(theRecords[paymentTypeCode]);
}


HTH



Steve

--- In flexcoders@yahoogroups.com, Jason B nos...@... wrote:

 var records:Array = new Array({
  AC: Remember to reset the station address.,
  RN: Remember to reset the station expiration date.,
  CP: Remember to contact contractor to remove the
certificates from this station.,
  CR: Remember to cancel the refund payment.
  });


 for each(test:Object in records){

 //HERE we match up PAYMENT TYPE CODE with AC RN CP if one is a match
we show the value

 if(grid.selectedItem.PAYMENT_TYPE_CODE == test[i])
  Alert.show(SHOW ME ---Remember to reset the station address );



 }


 datagrid hidden column AC, RN, CP are in datagrid
 user selects RT item from grid and hits button
 system match's that row with what message should be displayed
 user never see's RT since its a hidden field in grid
 user now see's a message displayed as a reminder







 --- In flexcoders@yahoogroups.com, Paul Andrews paul@ wrote:
 
  Jason,
 
  I'm not sure I follow exactly what the problem is now.
 
  Paul
  - Original Message -
  From: Jason B nospam@
  To: flexcoders@yahoogroups.com
  Sent: Thursday, May 21, 2009 4:02 PM
  Subject: [flexcoders] Re: simple array?
 
 
  i want to loop the records and compare the value addresschange to
the
  PAYMENT Type Code if its the right one display it
  
  
   --- In flexcoders@yahoogroups.com, Paul Andrews paul@ wrote:
  
  
   - Original Message -
   From: Jason B nospam@
   To: flexcoders@yahoogroups.com
   Sent: Thursday, May 21, 2009 3:46 PM
   Subject: [flexcoders] Re: simple array?
  
  
Thanks but i dont know how to do a compare based on your
example show?
  
for(var i:uint = 0; i  records.length; i++) {
//If array matchs show text
   if(payment_grid.selectedItem.PAYMENT_TYPE_CODE ==
   records[i].addresschange){
   Alert.show(records[i].addresschange);
   }
   }
  
  
   
   
for(var i:uint = 0; i  records.length; i++) {
//If array matchs show text
if(payment_grid.selectedItem.PAYMENT_TYPE_CODE ==
records.valueof
){
   Alert.show(records[0].addresschange);
   
}
   
   
   
--- In flexcoders@yahoogroups.com, Pedro Sena sena.pedro@
wrote:
   
records[0].addresschange
   
You are putting an object inside your array
   
Using records[0] you retrieve your object
using records[0].addresschange you access its property called
addresschange
   
On Thu, May 21, 2009 at 11:14 AM, Jason B nospam@ wrote:
   


 var records:Array = new Array({
 addresschange: Remember to reset the station address.,
 etc.
 });


 Alert.show(records['addresschange']);
 Alert.show(records[0]);
 Alert.show(records.addresschange);

 how the heck can i access the item directly by index name?



   
   
   
--
/**
* Pedro Sena
* Systems Architect
* Sun Certified Java Programmer
* Sun Certified Web Component Developer
*/
   
   
   
   
   

   
--
Flexcoders Mailing List
FAQ:
http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Alternative FAQ location:
   
https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-\
1e62079f6847
Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo!
Groups
Links
   
   
   
  
  
  
  
  
   
  
   --
   Flexcoders Mailing List
   FAQ:
http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
   Alternative FAQ location:
  
https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-\
1e62079f6847
   Search Archives:
   http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo!
Groups
   Links
  
  
  
 




Re: [flexcoders] Re: simple array?

2009-05-21 Thread Charles Parcell
First off, how about this then...

var records:Object = new {
AC: Remember to reset the station address.,
RN: Remember to reset the station expiration date.,
CP: Remember to contact contractor to remove the certificates from
this station.,
CR: Remember to cancel the refund payment.
};

Second you can then do the following...

CODE = grid.selectedItem.PAYMENT_TYPE_CODE;
if(records[CODE] != null ){
Alert.show(records[CODE]);
}

Charles P.


On Thu, May 21, 2009 at 1:14 PM, Jason B nos...@advancedonsite.com wrote:

 var records:Array = new Array({
 AC: Remember to reset the station address.,
RN: Remember to reset the station expiration date.,
CP: Remember to contact contractor to remove the
 certificates from this station.,
CR: Remember to cancel the refund payment.
});


 for each(test:Object in records){

 //HERE we match up PAYMENT TYPE CODE with AC RN CP if one is a match we
 show the value

 if(grid.selectedItem.PAYMENT_TYPE_CODE == test[i])
  Alert.show(SHOW ME ---Remember to reset the station address );



 }


 datagrid hidden column AC, RN, CP are in datagrid
 user selects RT item from grid and hits button
 system match's that row with what message should be displayed
 user never see's RT since its a hidden field in grid
 user now see's a message displayed as a reminder







 --- In flexcoders@yahoogroups.com, Paul Andrews p...@... wrote:
 
  Jason,
 
  I'm not sure I follow exactly what the problem is now.
 
  Paul
  - Original Message -
  From: Jason B nos...@...
  To: flexcoders@yahoogroups.com
  Sent: Thursday, May 21, 2009 4:02 PM
  Subject: [flexcoders] Re: simple array?
 
 
  i want to loop the records and compare the value addresschange to the
  PAYMENT Type Code if its the right one display it
  
  
   --- In flexcoders@yahoogroups.com, Paul Andrews paul@ wrote:
  
  
   - Original Message -
   From: Jason B nospam@
   To: flexcoders@yahoogroups.com
   Sent: Thursday, May 21, 2009 3:46 PM
   Subject: [flexcoders] Re: simple array?
  
  
Thanks but i dont know how to do a compare based on your example
 show?
  
for(var i:uint = 0; i  records.length; i++) {
//If array matchs show text
   if(payment_grid.selectedItem.PAYMENT_TYPE_CODE ==
   records[i].addresschange){
   Alert.show(records[i].addresschange);
   }
   }
  
  
   
   
for(var i:uint = 0; i  records.length; i++) {
//If array matchs show text
if(payment_grid.selectedItem.PAYMENT_TYPE_CODE == records.valueof
){
   Alert.show(records[0].addresschange);
   
}
   
   
   
--- In flexcoders@yahoogroups.com, Pedro Sena sena.pedro@ wrote:
   
records[0].addresschange
   
You are putting an object inside your array
   
Using records[0] you retrieve your object
using records[0].addresschange you access its property called
addresschange
   
On Thu, May 21, 2009 at 11:14 AM, Jason B nospam@ wrote:
   


 var records:Array = new Array({
 addresschange: Remember to reset the station address.,
 etc.
 });


 Alert.show(records['addresschange']);
 Alert.show(records[0]);
 Alert.show(records.addresschange);

 how the heck can i access the item directly by index name?



   
   
   
--
/**
* Pedro Sena
* Systems Architect
* Sun Certified Java Programmer
* Sun Certified Web Component Developer
*/
   
   
   
   
   

   
--
Flexcoders Mailing List
FAQ:
 http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Alternative FAQ location:
   
 https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo!
 Groups
Links
   
   
   
  
  
  
  
  
   
  
   --
   Flexcoders Mailing List
   FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
   Alternative FAQ location:
  
 https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
   Search Archives:
   http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
   Links
  
  
  
 




 

 --
 Flexcoders Mailing List
 FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
 Alternative FAQ location:
 https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
 Search Archives:
 http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
 Links






[flexcoders] Re: simple array?

2009-05-21 Thread Eric Cooper
How about this:

var records:Array = new Array(
{ code:AC, text:Remember to reset 
the station address. },
{ code:RN, text:Remember to reset 
the station expiration date. },
{ code:CP, text:Remember to contact 
contractor to remove the certificates from this station. },
{ code:CR, text:Remember to cancel 
the refund payment. },
);

for each(test:Object in records){
if(grid.selectedItem.PAYMENT_TYPE_CODE == test[i].code)
Alert.show(test[i].text );
}

would that do it?

-eric

--- In flexcoders@yahoogroups.com, Jason B nos...@... wrote:

 var records:Array = new Array({
   AC: Remember to reset the station address., 
   RN: Remember to reset the station expiration date.,
   CP: Remember to contact contractor to remove the 
 certificates from this station.,
   CR: Remember to cancel the refund payment.
   });
 
 
 for each(test:Object in records){
 
 //HERE we match up PAYMENT TYPE CODE with AC RN CP if one is a match we show 
 the value
 
 if(grid.selectedItem.PAYMENT_TYPE_CODE == test[i])
  Alert.show(SHOW ME ---Remember to reset the station address );
 
 
 
 }
 
 
 datagrid hidden column AC, RN, CP are in datagrid
 user selects RT item from grid and hits button
 system match's that row with what message should be displayed
 user never see's RT since its a hidden field in grid
 user now see's a message displayed as a reminder
 
 
 
 
 
 
 
 --- In flexcoders@yahoogroups.com, Paul Andrews paul@ wrote:
 
  Jason,
  
  I'm not sure I follow exactly what the problem is now.
  
  Paul
  - Original Message - 
  From: Jason B nospam@
  To: flexcoders@yahoogroups.com
  Sent: Thursday, May 21, 2009 4:02 PM
  Subject: [flexcoders] Re: simple array?
  
  
  i want to loop the records and compare the value addresschange to the 
  PAYMENT Type Code if its the right one display it
  
  
   --- In flexcoders@yahoogroups.com, Paul Andrews paul@ wrote:
  
  
   - Original Message - 
   From: Jason B nospam@
   To: flexcoders@yahoogroups.com
   Sent: Thursday, May 21, 2009 3:46 PM
   Subject: [flexcoders] Re: simple array?
  
  
Thanks but i dont know how to do a compare based on your example show?
  
for(var i:uint = 0; i  records.length; i++) {
//If array matchs show text
   if(payment_grid.selectedItem.PAYMENT_TYPE_CODE ==
   records[i].addresschange){
   Alert.show(records[i].addresschange);
   }
   }
  
  
   
   
for(var i:uint = 0; i  records.length; i++) {
//If array matchs show text
if(payment_grid.selectedItem.PAYMENT_TYPE_CODE == records.valueof 
){
   Alert.show(records[0].addresschange);
   
}
   
   
   
--- In flexcoders@yahoogroups.com, Pedro Sena sena.pedro@ wrote:
   
records[0].addresschange
   
You are putting an object inside your array
   
Using records[0] you retrieve your object
using records[0].addresschange you access its property called
addresschange
   
On Thu, May 21, 2009 at 11:14 AM, Jason B nospam@ wrote:
   


 var records:Array = new Array({
 addresschange: Remember to reset the station address.,
 etc.
 });


 Alert.show(records['addresschange']);
 Alert.show(records[0]);
 Alert.show(records.addresschange);

 how the heck can i access the item directly by index name?



   
   
   
-- 
/**
* Pedro Sena
* Systems Architect
* Sun Certified Java Programmer
* Sun Certified Web Component Developer
*/
   
   
   
   
   

   
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Alternative FAQ location:
https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
Links
   
   
   
  
  
  
  
  
   
  
   --
   Flexcoders Mailing List
   FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
   Alternative FAQ location: 
   https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
   Search Archives: 
   http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups 
   Links
  
  
  
 





Re: [flexcoders] Re: simple array?

2009-05-21 Thread Charles Parcell
Sorry the Object should be...

var records:Object = {
AC: Remember to reset the station address.,
RN: Remember to reset the station expiration date.,
CP: Remember to contact contractor to remove the certificates from
this station.,
CR: Remember to cancel the refund payment.
};

or you can...

var records:Object = new Object();
records[AC] = Remember to reset the station address.;
records[RN] = Remember to reset the station expiration date.;
records[CP] = Remember to contact contractor to remove the  certificates
from this station.;
records[CR] = Remember to cancel the refund payment.;

Charles P.


On Thu, May 21, 2009 at 2:37 PM, Charles Parcell pokemonkil...@gmail.comwrote:

 First off, how about this then...

 var records:Object = new {
 AC: Remember to reset the station address.,
 RN: Remember to reset the station expiration date.,
 CP: Remember to contact contractor to remove the certificates from
 this station.,
 CR: Remember to cancel the refund payment.
 };




[flexcoders] Re: simple array?

2009-05-21 Thread Jason B
SWEET thanks

--- In flexcoders@yahoogroups.com, Eric Cooper e...@... wrote:

 How about this:
 
 var records:Array = new Array(
   { code:AC, text:Remember to reset 
 the station address. },
   { code:RN, text:Remember to reset 
 the station expiration date. },
   { code:CP, text:Remember to contact 
 contractor to remove the certificates from this station. },
   { code:CR, text:Remember to cancel 
 the refund payment. },
   );
 
 for each(test:Object in records){
   if(grid.selectedItem.PAYMENT_TYPE_CODE == test[i].code)
   Alert.show(test[i].text );
   }
 
 would that do it?
 
 -eric
 
 --- In flexcoders@yahoogroups.com, Jason B nospam@ wrote:
 
  var records:Array = new Array({
  AC: Remember to reset the station address., 
  RN: Remember to reset the station expiration date.,
  CP: Remember to contact contractor to remove the 
  certificates from this station.,
  CR: Remember to cancel the refund payment.
  });
  
  
  for each(test:Object in records){
  
  //HERE we match up PAYMENT TYPE CODE with AC RN CP if one is a match we 
  show the value  
  
  if(grid.selectedItem.PAYMENT_TYPE_CODE == test[i])
   Alert.show(SHOW ME ---Remember to reset the station address );
  
  
  
  }
  
  
  datagrid hidden column AC, RN, CP are in datagrid
  user selects RT item from grid and hits button
  system match's that row with what message should be displayed
  user never see's RT since its a hidden field in grid
  user now see's a message displayed as a reminder
  
  
  
  
  
  
  
  --- In flexcoders@yahoogroups.com, Paul Andrews paul@ wrote:
  
   Jason,
   
   I'm not sure I follow exactly what the problem is now.
   
   Paul
   - Original Message - 
   From: Jason B nospam@
   To: flexcoders@yahoogroups.com
   Sent: Thursday, May 21, 2009 4:02 PM
   Subject: [flexcoders] Re: simple array?
   
   
   i want to loop the records and compare the value addresschange to the 
   PAYMENT Type Code if its the right one display it
   
   
--- In flexcoders@yahoogroups.com, Paul Andrews paul@ wrote:
   
   
- Original Message - 
From: Jason B nospam@
To: flexcoders@yahoogroups.com
Sent: Thursday, May 21, 2009 3:46 PM
Subject: [flexcoders] Re: simple array?
   
   
 Thanks but i dont know how to do a compare based on your example 
 show?
   
 for(var i:uint = 0; i  records.length; i++) {
 //If array matchs show text
if(payment_grid.selectedItem.PAYMENT_TYPE_CODE ==
records[i].addresschange){
Alert.show(records[i].addresschange);
}
}
   
   


 for(var i:uint = 0; i  records.length; i++) {
 //If array matchs show text
 if(payment_grid.selectedItem.PAYMENT_TYPE_CODE == records.valueof 
 ){
Alert.show(records[0].addresschange);

 }



 --- In flexcoders@yahoogroups.com, Pedro Sena sena.pedro@ wrote:

 records[0].addresschange

 You are putting an object inside your array

 Using records[0] you retrieve your object
 using records[0].addresschange you access its property called
 addresschange

 On Thu, May 21, 2009 at 11:14 AM, Jason B nospam@ wrote:

 
 
  var records:Array = new Array({
  addresschange: Remember to reset the station address.,
  etc.
  });
 
 
  Alert.show(records['addresschange']);
  Alert.show(records[0]);
  Alert.show(records.addresschange);
 
  how the heck can i access the item directly by index name?
 
 
 



 -- 
 /**
 * Pedro Sena
 * Systems Architect
 * Sun Certified Java Programmer
 * Sun Certified Web Component Developer
 */





 

 --
 Flexcoders Mailing List
 FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
 Alternative FAQ location:
 https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
 Search Archives:
 http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
 Links



   
   
   
   
   

   
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Alternative FAQ location: 
https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
Search Archives: 
http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups 
Links
   
   
   
  
 





[flexcoders] Re: simple array?

2009-05-21 Thread Eric Cooper
I just tried compiling what I wrote - and realized that it didn't... so here 
are two variants. The first is same as previous, but it compiles. The second 
may be more in the spirit of what you were attempting initially - and kind of 
highlights similarities between arrays and objects.

First:

var records:Array = new Array(
{ code:AC, text:Remember to reset 
the station address. },
{ code:RN, text:Remember to reset 
the station expiration date. },
{ code:CP, text:Remember to contact 
contractor to remove the certificates from this station. },
{ code:CR, text:Remember to cancel 
the refund payment. }
);

for each (var test:Object in records) {
if (grid.selectedItem.PAYMENT_TYPE_CODE 
== test.code)
Alert.show(test.text );
}


Second:

var PAYMENT_TYPE_CODE:String = CR;
var records:Array = new Array(
{ AC: Remember to reset the station 
address. },
{ RN: Remember to reset the station 
expiration date. },
{ CP: Remember to contact contractor 
to remove the certificates from this station. },
{ CR: Remember to cancel the refund 
payment. }
);

for (var i:int = 0; i  records.length; ++i) {
if 
(records[i][grid.selectedItem.PAYMENT_TYPE_CODE])

Alert.show(records[i][PAYMENT_TYPE_CODE]);
}




--- In flexcoders@yahoogroups.com, Jason B nos...@... wrote:

 SWEET thanks
 
 --- In flexcoders@yahoogroups.com, Eric Cooper eric@ wrote:
 
  How about this:
  
  var records:Array = new Array(
  { code:AC, text:Remember to reset 
  the station address. },
  { code:RN, text:Remember to reset 
  the station expiration date. },
  { code:CP, text:Remember to contact 
  contractor to remove the certificates from this station. },
  { code:CR, text:Remember to cancel 
  the refund payment. },
  );
  
  for each(test:Object in records){
  if(grid.selectedItem.PAYMENT_TYPE_CODE == test[i].code)
  Alert.show(test[i].text );
  }
  
  would that do it?
  
  -eric
  
  --- In flexcoders@yahoogroups.com, Jason B nospam@ wrote:
  
   var records:Array = new Array({
 AC: Remember to reset the station address., 
 RN: Remember to reset the station expiration date.,
 CP: Remember to contact contractor to remove the 
   certificates from this station.,
 CR: Remember to cancel the refund payment.
 });
   
   
   for each(test:Object in records){
   
   //HERE we match up PAYMENT TYPE CODE with AC RN CP if one is a match we 
   show the value
   
   if(grid.selectedItem.PAYMENT_TYPE_CODE == test[i])
Alert.show(SHOW ME ---Remember to reset the station address );
   
   
   
   }
   
   
   datagrid hidden column AC, RN, CP are in datagrid
   user selects RT item from grid and hits button
   system match's that row with what message should be displayed
   user never see's RT since its a hidden field in grid
   user now see's a message displayed as a reminder
   
   
   
   
   
   
   
   --- In flexcoders@yahoogroups.com, Paul Andrews paul@ wrote:
   
Jason,

I'm not sure I follow exactly what the problem is now.

Paul
- Original Message - 
From: Jason B nospam@
To: flexcoders@yahoogroups.com
Sent: Thursday, May 21, 2009 4:02 PM
Subject: [flexcoders] Re: simple array?


i want to loop the records and compare the value addresschange to 
the 
PAYMENT Type Code if its the right one display it


 --- In flexcoders@yahoogroups.com, Paul Andrews paul@ wrote:


 - Original Message - 
 From: Jason B nospam@
 To: flexcoders@yahoogroups.com
 Sent: Thursday, May 21, 2009 3:46 PM
 Subject: [flexcoders] Re: simple array?


  Thanks but i dont know how to do a compare based on your example 
  show?

  for(var i:uint = 0; i  records.length; i++) {
  //If array matchs show text
 if(payment_grid.selectedItem.PAYMENT_TYPE_CODE