declare myXML outside the function.otherwise its scope is limited within first function only.
On Mon, Feb 2, 2009 at 4:23 PM, NisanthKumar <[email protected]>wrote: > > Im Using the following code but the value of xml not coming on the > second function give me a solution > > <?xml version="1.0" encoding="utf-8"?> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" > layout="vertical" creationComplete="phpService2.send()" > xmlns:local="*"> > > > <mx:HTTPService id="phpService2" url="http://192.168.0.122/FundookStat/ > stats2.php <http://192.168.0.122/FundookStat/%0Astats2.php>" method="POST" > resultFormat="e4x" result="showAll()"> > </mx:HTTPService> > <mx:Script> > <![CDATA[ > import flash.net.sendToURL; > > public var col2:DataGridColumn; > import mx.controls.dataGridClasses.DataGridColumn; > import mx.collections.XMLListCollection; > import mx.collections.ArrayCollection; > import mx.collections.SortField; > import mx.collections.Sort; > import mx.controls.Alert; > > > public function showAll():void{ > > var myXML:XML = new XML(phpService2.lastResult); > myDG.dataProvider = myXML..loc; > } > > private function lastTotal(col:DataGridColumn):String{ > > var myXML:XML = myXML; > //Alert.show(myXML,"xml"); > var rowList:XMLList = myXML.children(); > var txt:String; > txt = String(rowList.length()); > //Alert.show(txt,"length"); > var avg:int = 0; > //var authorList:XMLList = bookInput.Book.author; > //var txt:String; > //txt = String(rowList); > //Alert.show(txt,"length"); > for (var i:int = 0; i < rowList.length(); i++) > { > var aaa:String = rowList[i].total; > //Alert.show(aaa,"values"); > var txt4:int; > txt4 = int(aaa); > //Alert.show(txt4,"values"); > avg += txt4 ; > var txt2:String; > txt2 = String(avg); > //Alert.show(txt2); > // > } > Alert.show(txt,"total"); > return "Total:"+txt; > } > > > > ]]> > </mx:Script> > > <local:FooterDataGrid id="myDG" paddingTop="0" paddingBottom="0" > verticalAlign="middle" > > <local:columns> > <local:FooterDataGridColumn headerText="Sl No" > dataField="slno" width="100" > > <mx:DataGridColumn headerText=" " dataField="slno" > width="100"/> > </local:FooterDataGridColumn> > <local:FooterDataGridColumn headerText="Location" > dataField="location" width="100" > > <mx:DataGridColumn headerText=" " dataField="location" > width="100"/> > </local:FooterDataGridColumn> > <local:FooterDataGridColumn headerText="Today" > dataField="today" > > <mx:DataGridColumn dataField="today" width="100"/> > </local:FooterDataGridColumn> > <local:FooterDataGridColumn headerText="Yesterday" > dataField="yesterday" > > <mx:DataGridColumn dataField="yesterday" width="100"/> > </local:FooterDataGridColumn> > <local:FooterDataGridColumn headerText="Last 7 Days" > dataField="lastseven" > > <mx:DataGridColumn dataField="lastseven" width="100" /> > </local:FooterDataGridColumn> > <local:FooterDataGridColumn headerText="Last 30 days" > dataField="lastthirty" > > <mx:DataGridColumn dataField="lastthirty" width="100"/> > </local:FooterDataGridColumn> > <local:FooterDataGridColumn headerText="Total" > dataField="total" > > <mx:DataGridColumn dataField="total" width="100" /> > </local:FooterDataGridColumn> > </local:columns> > </local:FooterDataGrid> > > > </mx:Application> > > > Thanks Nisanth > > > > -- Thanks & Regards GK --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/flex_india?hl=en -~----------~----~----~----~------~----~------~--~---

