Hi Anil,

Did you have look at this link, I had to work with json quite long
ago, I had also had faced the problem,

http://www.waynemike.co.uk/jswoof

Let me know any further Development

Regads,
Ranjit Sail

On Sep 28, 4:53 pm, Anil <anil.kadimise...@gmail.com> wrote:
> Hi,
> I was trying to use teh JSON API from as3corelib project.
>
> I tried a simple example but am getting error 1065 when i run it.
> I get the below run time error:
>
> ReferenceError: Error #1065: Variable {"id":
> 646,"method":"getInfo","jsonrpc":"2","params":[]} is not defined.
>
>       at global/flash.utils::getDefinitionByName()
>
>       at mx.utils::DescribeTypeCache$/describeType()[C:\autobuild
> \3.2.0\frameworks\projects\framework\src\mx\utils\DescribeTypeCache.as:
> 95]
>
>       at mx.utils::ObjectUtil$/getClassInfo()[C:\autobuild
> \3.2.0\frameworks\projects\framework\src\mx\utils\ObjectUtil.as:829]
>
>       at mx.rpc.http::HTTPService/send()[C:\autobuild\3.2.0\frameworks
> \projects\rpc\src\mx\rpc\http\HTTPService.as:710]
>
>       at mx.rpc.http.mxml::HTTPService/send()[C:\autobuild
> \3.2.0\frameworks\projects\rpc\src\mx\rpc\http\mxml\HTTPService.as:
> 232]
>
>       at Px2try/doLogin()[C:\Documents and Settings\anilk\workspace
> \Px2try\src\Px2try.mxml:30]
>
>       at Px2try/___Px2try_Application1_creationComplete()[C:\Documents
> and Settings\anilk\workspace\Px2try\src\Px2try.mxml:3]
>
>       at flash.events::EventDispatcher/dispatchEventFunction()
>
>       at flash.events::EventDispatcher/dispatchEvent()
>
>       at mx.core::UIComponent/dispatchEvent()[C:\autobuild
> \3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:9298]
>
>       at mx.core::UIComponent/set initialized()[C:\autobuild
> \3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:1169]
>
>       at mx.managers::LayoutManager/doPhasedInstantiation()[C:
> \autobuild\3.2.0\frameworks\projects\framework\src\mx\managers
> \LayoutManager.as:718]
>
>       at Function/http://adobe.com/AS3/2006/builtin::apply()
>
>       at mx.core::UIComponent/callLaterDispatcher2()[C:\autobuild
> \3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:8628]
>
>       at mx.core::UIComponent/callLaterDispatcher()[C:\autobuild
> \3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:8568]
>
> The source code is as below:-
>
> <?xml version="1.0" encoding="utf-8"?>
>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
> layout="absolute"
>
>       xmlns="*" creationComplete="doLogin()">
>
>       <mx:Script>
>
>             <![CDATA[
>
>                   import mx.controls.Alert;
>
>                   import mx.rpc.events.FaultEvent;
>
>                   import mx.collections.ArrayCollection;
>
>                   import com.adobe.serialization.json.JSON;
>
>                   import mx.rpc.events.ResultEvent;
>
>                   private function resultHandler
> (event:ResultEvent):void
>
>                   {
>
>                         var rawData:String = event.result.toString();
>
>                         var arr:Array = (JSON.decode(rawData) as
> Array);
>
>                         var arrCol:ArrayCollection = new
> ArrayCollection(arr);
>
>                         trace(arrCol);
>
>                   }
>
>                   private function faultHandler(event:FaultEvent):void
>
>                   {
>
>                         Alert.show(event.fault.toString());
>
>                   }
>
>                   public function doLogin():void
>
>                   {
>
>                         var obj:Object =
> {"jsonrpc":"2","method":"getInfo","params":[],"id":646};
>
>                         var req:String = JSON.encode(obj);
>
>                         trace(req);
>
>                         service.send(req);
>
>                   }
>
>             ]]>
>
>       </mx:Script>
>
>       <mx:HTTPService id="service" resultFormat="text"
>
>                         url="someurl"
>
>                         result="resultHandler(event)"
>
>                         fault="faultHandler(event)" />
>
> </mx:Application>
>
> I added the swc to the library path manually.
>
> Please let me know what am I missing.
>
> Thanks,
>
> Anil
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to flex_india@googlegroups.com
To unsubscribe from this group, send email to 
flex_india+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to