Either the whole entry is null or one of it's properties. Check which is null, and guard your code if null put empty string or whatever you seem fit for it.
C
From: ZIONIST <stinasius@yahoo.com>
To: flexcoders@yahoogroups.com
Sent: Tuesday, December 27, 2011 5:41 PM
Subject: [flexcoders] Re: Using arraycollection as text for a flex TextArea Component.
That works well. It actually outputs the contents of the arraycollection in the textarea component. One very small issue though, it outputs the word NULL before the last item in the arraycollection. How do i get rid of that?
Below is the update.
[Bindable]
private var orderColl:ArrayCollection=new ArrayCollection();
/*** Create an object to hold the data ***/
var obj:Object=new Object();
/*** Assign the variables to it ***/
obj.Product=product.text;
obj.Price=price.text;
obj.Qty=1;
obj.OrderNumber=label1.text;
/*** Add the object to the list ***/
orderColl.addItemAt(obj, 0);
Then i have a TextArea component (id=cart) and i try to assign the arraycollection to it as text like this
var txt:String;
var n:int=orderColl.length;
for (var i:int=0; i < n; i++)
{
var entry:Object=orderColl.getItemAt(i);
txt += entry.OrderNumber + "," + " " + entry.Product + "," + " " + entry.Qty + " " + "Unit" + "(" + "s" + ")" + "," + " " + "$" + entry.Price + " " + "per unit" + "\n\n";
}
cart.text = txt;
Below is the update.
[Bindable]
private var orderColl:ArrayCollection=new ArrayCollection();
/*** Create an object to hold the data ***/
var obj:Object=new Object();
/*** Assign the variables to it ***/
obj.Product=product.text;
obj.Price=price.text;
obj.Qty=1;
obj.OrderNumber=label1.text;
/*** Add the object to the list ***/
orderColl.addItemAt(obj, 0);
Then i have a TextArea component (id=cart) and i try to assign the arraycollection to it as text like this
var txt:String;
var n:int=orderColl.length;
for (var i:int=0; i < n; i++)
{
var entry:Object=orderColl.getItemAt(i);
txt += entry.OrderNumber + "," + " " + entry.Product + "," + " " + entry.Qty + " " + "Unit" + "(" + "s" + ")" + "," + " " + "$" + entry.Price + " " + "per unit" + "\n\n";
}
cart.text = txt;
__._,_.___
--
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.com
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.com
MARKETPLACE
.
__,_._,___
0 comments:
Post a Comment