Hi, I think u change the
resultFormat="text"; contentType="application/json"; Thanks & Reg Bambam On Thu, Aug 11, 2011 at 2:35 PM, Abhi <[email protected]> wrote: > Hi All, > > I am using flex 4 and i want to get data through json file. > > I have try to below code but every time http server send fault event:- > > <?xml version="1.0" encoding="utf-8"?> > <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" > xmlns:s="library://ns.adobe.com/flex/spark" > xmlns:mx="library://ns.adobe.com/flex/mx" > xmlns:h="library://ns.adobe.com/flex/halo" > creationComplete="init();" minWidth="955" > minHeight="600"> > <fx:Script> > <![CDATA[ > import com.json.JSON; > > import mx.collections.ArrayCollection; > import mx.controls.Alert; > import mx.rpc.events.FaultEvent; > import mx.rpc.events.ResultEvent; > import mx.utils.ObjectUtil; > > [Bindable] private var dataArrayApi:ArrayCollection; > [Bindable] private var parr:ArrayCollection; > [Bindable] private var mytitle:String; > [Bindable] private var subtitle:String; > [Bindable] private var treeData:ArrayCollection=new > ArrayCollection(); > > public function init():void > { > service.headers = { > Accept:"application/json" }; > service.send(); > } > > public function > httpService_result(event:ResultEvent):void > { > dataArrayApi = event.result.children as > ArrayCollection; > > Alert.show(ObjectUtil.toString(dataArrayApi.source)); > } > > public function > httpService_fault(event:FaultEvent):void > { > Alert.show(''+event); > } > ]]> > </fx:Script> > > <fx:Declarations> > <!-- Place non-visual elements (e.g., services, value > objects) here > --> > <s:HTTPService > id="service" resultFormat="e4x" > url="http://localhost/eyetry/json/models.json" > useProxy="false" > fault="httpService_fault(event)" > result="httpService_result(event)" /> > </fx:Declarations> > </s:Application> > > I will very thankful to you please help me. > > abid > > -- > 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. > > -- 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.

