Are the print filter arrays defined in the
method itself or as instance variables? They will be static if you assign them
as instance variables, so you don’t want to do that. If this is all in the
same method they should be separate instances. You could try assigning to []
instead of new Array() just to test something else.
Matt
From:
flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of jamiebadman
Sent: Tuesday, November 29, 2005
7:59 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Arrays
sharing the same memory ?!
Hi,
Wonder if someone can help ?
I have the following code:
var mciPrintFilter = new Array();
var wholesalePrintFilter = new Array();
if (result.length > 0){
// Need to split up the returned
array into two sub-arrays for filtering by customer type
for (var i = 0; i <
ModelLocator.printCreditList.length; i++){
if
(ModelLocator.printCreditList[i].ro_customer_type == 1){
mciPrintFilter.push(ModelLocator.printCreditList[i]);
} else {
wholesalePrintFilter.push(ModelLocator.printCreditList[i]);
}
}
mx.core.Application.alert( "MCI:
" + mciPrintFilter.length );
mx.core.Application.alert(
"MCIW: " + wholesalePrintFilter.length );
mx.core.Application.alert( "ALL:
" + ModelLocator.printCreditList.length );
}
-----
The problem seems to be that the lengths for each
of the arrays at the end is exactly the same! It seems that mciPrintFilter and
wholesalePrintFilter share the same memory space or something - since I also
tried commenting out that loop, inserting one element from printCreditList into
mciPrintFilter and then checking the length of wholesalePrintFilter - and it
increases by one!
Pretty certain I'm doing something dumb ;-)
Can anyone help me out please ?!
Thanks,
Jamie.
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
YAHOO! GROUPS LINKS
|