Ask a Question related to Macromedia Flex General Discussion, Design and Development.
-
Handycam #1
Converting an XML Array to a multi-level array
I have an array assigned to a data grid such as:
private var myIngredients:Array = new Array(
<item ln1="Plain" sn="plain" ln2="(3 cups) confectioners sugar" qty="12-1/2"
units="oz." />,
<item ln1="Maple" sn="maple" ln2="pure maple syrup, more as needed" qty="1"
units="cup" />,
<item ln1="Lemon" sn="lemon" ln2="fresh lemon juice, more as needed" qty="6"
units="Tbs." />
);
However, the data grid only has 3 columns, which display only @qty, @units,
and @ln2.
I need to deliver an array of arrays of those items only, as in:
private var finalIngrtedientList:Array = new Array(
["12-1/2","oz.","(3 cups) confectioners sugar"],
["1","cup","pure maple syrup, more as needed"],
["6","Tbs.","fresh lemon juice, more as needed"]
);
What's the easiest way to accomplish this?'
Handycam Guest
-
New pure perl multi-level hash/array DBM
Hey all, I have just completed a very unique DBM, written in pure perl, and submitted it to CPAN. It has true multi-level hash/array support... -
Multi-dimensioned sparse array ?
Does anyone have an implementation of a multi-dimensioned sparse array? The only implementation that I can think of involves a mesh of... -
how to pass multi array as args
Can someone show me how to pass multiple arrays argument? ie - .... mysub(@a, @b, @c); .... sub mysub { my @a = ? #arg1 an array $_ is... -
Multi-dimensional Array
Hi, Array-Question: Suppose you have an array like: <? $invoices=$taxrate; $invoices=a number; ?> -
sorting multi-array
hello, i have got a problem, tehere is an array: $x = array( array(15,55,array(1,2,3),3,5,array(1,2,5)),... -
ntsiii #2
Re: Converting an XML Array to a multi-level array
You have an Array of XML nodes. That is quite odd. Why are you not using a
normal dataProvider?
Whatever, assuming you have a good reason, there is not an automatic way to do
that. You will just need to loop over your nodes and build the array elements,
and push them onto the array.
Tracy
ntsiii Guest
-
Handycam #3
Re: Converting an XML Array to a multi-level array
I did that because most of the datagrids in the ap use XML data from an XML
file.
[url]http://www.taunton.com/finecooking/cyor/muffins.aspx?ac=fp[/url]
So the app has a series of drag n drop grids, the left "from" lists are loaded
from XML file. Then I use the ArrayCollection of the destination list to
populate other items in the app as process the recipe instructions. I need to
keep the data "live", since the user can go back at any time and make changes
that then need to ripple into the recipe.
Occasionally, the client needs to add a few "hard-coded" items to this "chosen
item" data set, so I create an Array in the same format as the existing XML
data, so they can mix together seamlessly.
I wish there was a better way, but this works so far.
So what I am doing now is
private function save():void {
saveIngredients = [];
var len:uint = _muffins.length;
for (var i:int=0; i<len; i++){
var a:Array = [];
a.push(_muffins[i].@qty);
a.push(_muffins[i].@units);
a.push(_muffins[i].@ln2);
ingredients1.push(a);
}
saveIngredients.push(ingredients1);
}
Handycam Guest



Reply With Quote

