>I looked at the documentation for the XML object and it says how to retreive
>attributes, but doesn't seem to discuss adding attributes to a node.
>
The answers you seek are in the flexdocs for XMLNode, not XML :) This is
untested, so you may have to fiddle a little - but here's the jist..
public function buildNode( newNode:String, parentNode:String, contents:Array
):XML
{
var buffer:XML = new XML( parentNode );
for( var i:int = 0; i < contents.length; i++ )
{
var node:XMLNode = new XMLNode(1, null);
node.nodeName = newNode;
node.attributes = {value:contents[i]};
buffer.appendChild( node );
}
return buffer;
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Deploy Web Applications Quickly across the enterprise with ColdFusion MX7 &
Flex 2
Free Trial
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJU
Archive: http://www.houseoffusion.com/groups/Flex/message.cfm/messageid:3823
Subscription: http://www.houseoffusion.com/groups/Flex/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.37