If my xml structure looks like this:
var inputXML:XML =
<books>
<book name="da vinci code" author="dan brown" price="12.22"
quantity="2"/>
<book name="angels and daemons" author="dan brown" price="10.20"
quantity="4"/>
<book name="digital fortress" author="dan brown" price="12.22"
quantity="5"/>
</books>;
I wanted an e4x expression to get the total of price*quantity across
all the books.
The way I am trying to achieve this is:
define a function:
public function addToTotal(totalObj:Object,
perBookTotal:Number):void
{
totalObj.totalAmt+=perBookTotal;
}
then call the function from e4x expression:
var totalClass = new Object();
totalClass.totalAmt = 0;
inputXML.book.(addToTotal(
totalClass, Number(@price)*Number(@quantity)));
trace(totalClass.totalAmt);
I am in the process of trying this. Is this going to work at all? Or
is there a better way of achieving this.
Thanks in advance for all the help.
------------------------ Yahoo! Groups Sponsor --------------------~-->
Great things are happening at Yahoo! Groups. See the new email design.
http://us.click.yahoo.com/TISQkA/hOaOAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~->
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/