Hiya, I can't seem to get the JSON.decode() method to work. I have read a couple of blog tutorials and the string is tracing fine but when I pass it I get the message:

Error: Unexpected j encountered
        at com.adobe.serialization.json::JSONTokenizer/parseError()
        at com.adobe.serialization.json::JSONTokenizer/getNextToken()
        at com.adobe.serialization.json::JSONDecoder/nextToken()
        at com.adobe.serialization.json::JSONDecoder()
        at com.adobe.serialization.json::JSON$/decode()
        at JSONExample/decodeJSON()
        at flash.events::EventDispatcher/dispatchEventFunction()
        at flash.events::EventDispatcher/dispatchEvent()
        at flash.net::URLLoader/onComplete()


I'm not sure what I'm doing wrong, if someone could point me in the right direction it would be a big help.
Cheers!
Ali


///////////////////////
my code:

                private function createLoader():void
                {
                        trace("createLoader");
var request:URLRequest = new URLRequest("http://www.flickr.com/ services/feeds/photos_public.gne?tags=flex&format=json");
                        loader = new URLLoader();
                        loader.load(request);
                        loader.addEventListener(Event.COMPLETE, decodeJSON)
                }               
                private function decodeJSON(event:Event):void
                {
                        trace("event target:"+event.target.data);
                        var my_ar:Array = JSON.decode(event.target.data) ;
                }


////////////////////


ps I'm also getting these error msgs when I compile:

/Volumes/1alic07/AC_WorkingFolder/Experiments/JSONExample/src/com/ adobe/serialization/json/JSONEncoder.as(54): col: 19 Warning: The super() statement will be executed prior to entering this constructor. Add a call to super() within the constructor if you want to explicitly control when it is executed.

                public function JSONEncoder( value:* ) {
                                ^

/Volumes/1alic07/AC_WorkingFolder/Experiments/JSONExample/src/com/ adobe/serialization/json/JSONDecoder.as(59): col: 19 Warning: The super() statement will be executed prior to entering this constructor. Add a call to super() within the constructor if you want to explicitly control when it is executed.

                public function JSONDecoder( s:String ) {
                                ^

/Volumes/1alic07/AC_WorkingFolder/Experiments/JSONExample/src/com/ adobe/serialization/json/JSONTokenizer.as(59): col: 19 Warning: The super() statement will be executed prior to entering this constructor. Add a call to super() within the constructor if you want to explicitly control when it is executed.

                public function JSONTokenizer( s:String ) {
                                ^

/Volumes/1alic07/AC_WorkingFolder/Experiments/JSONExample/src/com/ adobe/serialization/json/JSONToken.as(52): col: 19 Warning: The super () statement will be executed prior to entering this constructor. Add a call to super() within the constructor if you want to explicitly control when it is executed.

public function JSONToken( type:int = -1 /* JSONTokenType.UNKNOWN */, value:Object = null ) {
                                ^

/Volumes/1alic07/AC_WorkingFolder/Experiments/JSONExample/deploy/ JSONExample.swf (4558 bytes)
(fcsh) compile 1
Loading configuration file /Developer/SDKs/flex_sdk_3/frameworks/flex- config.xml Loading configuration file /Volumes/1alic07/AC_WorkingFolder/ Experiments/JSONExample/src/JSONExample-config.xml Recompile: /Volumes/1alic07/AC_WorkingFolder/Experiments/JSONExample/ src/JSONExample.as
Reason: The source file or one of the included files has been updated.
Files changed: 1 Files affected: 0
/Volumes/1alic07/AC_WorkingFolder/Experiments/JSONExample/src/com/ adobe/serialization/json/JSONEncoder.as(54): col: 19 Warning: The super() statement will be executed prior to entering this constructor. Add a call to super() within the constructor if you want to explicitly control when it is executed.

                public function JSONEncoder( value:* ) {
                                ^

/Volumes/1alic07/AC_WorkingFolder/Experiments/JSONExample/src/com/ adobe/serialization/json/JSONDecoder.as(59): col: 19 Warning: The super() statement will be executed prior to entering this constructor. Add a call to super() within the constructor if you want to explicitly control when it is executed.

                public function JSONDecoder( s:String ) {
                                ^

/Volumes/1alic07/AC_WorkingFolder/Experiments/JSONExample/src/com/ adobe/serialization/json/JSONTokenizer.as(59): col: 19 Warning: The super() statement will be executed prior to entering this constructor. Add a call to super() within the constructor if you want to explicitly control when it is executed.

                public function JSONTokenizer( s:String ) {
                                ^

/Volumes/1alic07/AC_WorkingFolder/Experiments/JSONExample/src/com/ adobe/serialization/json/JSONToken.as(52): col: 19 Warning: The super () statement will be executed prior to entering this constructor. Add a call to super() within the constructor if you want to explicitly control when it is executed.

public function JSONToken( type:int = -1 /* JSONTokenType.UNKNOWN */, value:Object = null ) {
                                ^

/Volumes/1alic07/AC_WorkingFolder/Experiments/JSONExample/deploy/ JSONExample.swf (4573 bytes)
(fcsh) compile 1
Loading configuration file /Developer/SDKs/flex_sdk_3/frameworks/flex- config.xml Loading configuration file /Volumes/1alic07/AC_WorkingFolder/ Experiments/JSONExample/src/JSONExample-config.xml Recompile: /Volumes/1alic07/AC_WorkingFolder/Experiments/JSONExample/ src/JSONExample.as
Reason: The source file or one of the included files has been updated.
Files changed: 1 Files affected: 0
/Volumes/1alic07/AC_WorkingFolder/Experiments/JSONExample/src/com/ adobe/serialization/json/JSONEncoder.as(54): col: 19 Warning: The super() statement will be executed prior to entering this constructor. Add a call to super() within the constructor if you want to explicitly control when it is executed.

                public function JSONEncoder( value:* ) {
                                ^

/Volumes/1alic07/AC_WorkingFolder/Experiments/JSONExample/src/com/ adobe/serialization/json/JSONDecoder.as(59): col: 19 Warning: The super() statement will be executed prior to entering this constructor. Add a call to super() within the constructor if you want to explicitly control when it is executed.

                public function JSONDecoder( s:String ) {
                                ^

/Volumes/1alic07/AC_WorkingFolder/Experiments/JSONExample/src/com/ adobe/serialization/json/JSONTokenizer.as(59): col: 19 Warning: The super() statement will be executed prior to entering this constructor. Add a call to super() within the constructor if you want to explicitly control when it is executed.

                public function JSONTokenizer( s:String ) {
                                ^

/Volumes/1alic07/AC_WorkingFolder/Experiments/JSONExample/src/com/ adobe/serialization/json/JSONToken.as(52): col: 19 Warning: The super () statement will be executed prior to entering this constructor. Add a call to super() within the constructor if you want to explicitly control when it is executed.

public function JSONToken( type:int = -1 /* JSONTokenType.UNKNOWN */, value:Object = null ) {
                                ^

/Volumes/1alic07/AC_WorkingFolder/Experiments/JSONExample/deploy/ JSONExample.swf (4638 bytes)
(fcsh) compile 1
Loading configuration file /Developer/SDKs/flex_sdk_3/frameworks/flex- config.xml Loading configuration file /Volumes/1alic07/AC_WorkingFolder/ Experiments/JSONExample/src/JSONExample-config.xml Recompile: /Volumes/1alic07/AC_WorkingFolder/Experiments/JSONExample/ src/JSONExample.as
Reason: The source file or one of the included files has been updated.
Files changed: 1 Files affected: 0
/Volumes/1alic07/AC_WorkingFolder/Experiments/JSONExample/src/com/ adobe/serialization/json/JSONEncoder.as(54): col: 19 Warning: The super() statement will be executed prior to entering this constructor. Add a call to super() within the constructor if you want to explicitly control when it is executed.

                public function JSONEncoder( value:* ) {
                                ^

/Volumes/1alic07/AC_WorkingFolder/Experiments/JSONExample/src/com/ adobe/serialization/json/JSONDecoder.as(59): col: 19 Warning: The super() statement will be executed prior to entering this constructor. Add a call to super() within the constructor if you want to explicitly control when it is executed.

                public function JSONDecoder( s:String ) {
                                ^

/Volumes/1alic07/AC_WorkingFolder/Experiments/JSONExample/src/com/ adobe/serialization/json/JSONTokenizer.as(59): col: 19 Warning: The super() statement will be executed prior to entering this constructor. Add a call to super() within the constructor if you want to explicitly control when it is executed.

                public function JSONTokenizer( s:String ) {
                                ^

/Volumes/1alic07/AC_WorkingFolder/Experiments/JSONExample/src/com/ adobe/serialization/json/JSONToken.as(52): col: 19 Warning: The super () statement will be executed prior to entering this constructor. Add a call to super() within the constructor if you want to explicitly control when it is executed.

public function JSONToken( type:int = -1 /* JSONTokenType.UNKNOWN */, value:Object = null ) {
                                ^

/Volumes/1alic07/AC_WorkingFolder/Experiments/JSONExample/deploy/ JSONExample.swf (4632 bytes)
(fcsh) compile 1
Loading configuration file /Developer/SDKs/flex_sdk_3/frameworks/flex- config.xml Loading configuration file /Volumes/1alic07/AC_WorkingFolder/ Experiments/JSONExample/src/JSONExample-config.xml Recompile: /Volumes/1alic07/AC_WorkingFolder/Experiments/JSONExample/ src/JSONExample.as
Reason: The source file or one of the included files has been updated.
Files changed: 1 Files affected: 0
/Volumes/1alic07/AC_WorkingFolder/Experiments/JSONExample/src/com/ adobe/serialization/json/JSONEncoder.as(54): col: 19 Warning: The super() statement will be executed prior to entering this constructor. Add a call to super() within the constructor if you want to explicitly control when it is executed.

                public function JSONEncoder( value:* ) {
                                ^

/Volumes/1alic07/AC_WorkingFolder/Experiments/JSONExample/src/com/ adobe/serialization/json/JSONDecoder.as(59): col: 19 Warning: The super() statement will be executed prior to entering this constructor. Add a call to super() within the constructor if you want to explicitly control when it is executed.

                public function JSONDecoder( s:String ) {
                                ^

/Volumes/1alic07/AC_WorkingFolder/Experiments/JSONExample/src/com/ adobe/serialization/json/JSONTokenizer.as(59): col: 19 Warning: The super() statement will be executed prior to entering this constructor. Add a call to super() within the constructor if you want to explicitly control when it is executed.

                public function JSONTokenizer( s:String ) {
                                ^

/Volumes/1alic07/AC_WorkingFolder/Experiments/JSONExample/src/com/ adobe/serialization/json/JSONToken.as(52): col: 19 Warning: The super () statement will be executed prior to entering this constructor. Add a call to super() within the constructor if you want to explicitly control when it is executed.

public function JSONToken( type:int = -1 /* JSONTokenType.UNKNOWN */, value:Object = null ) {
                                ^

/Volumes/1alic07/AC_WorkingFolder/Experiments/JSONExample/deploy/ JSONExample.swf (4615 bytes)
(fcsh) compile 1
Loading configuration file /Developer/SDKs/flex_sdk_3/frameworks/flex- config.xml Loading configuration file /Volumes/1alic07/AC_WorkingFolder/ Experiments/JSONExample/src/JSONExample-config.xml Recompile: /Volumes/1alic07/AC_WorkingFolder/Experiments/JSONExample/ src/JSONExample.as
Reason: The source file or one of the included files has been updated.
Files changed: 1 Files affected: 0
/Volumes/1alic07/AC_WorkingFolder/Experiments/JSONExample/src/com/ adobe/serialization/json/JSONEncoder.as(54): col: 19 Warning: The super() statement will be executed prior to entering this constructor. Add a call to super() within the constructor if you want to explicitly control when it is executed.

                public function JSONEncoder( value:* ) {
                                ^

/Volumes/1alic07/AC_WorkingFolder/Experiments/JSONExample/src/com/ adobe/serialization/json/JSONDecoder.as(59): col: 19 Warning: The super() statement will be executed prior to entering this constructor. Add a call to super() within the constructor if you want to explicitly control when it is executed.

                public function JSONDecoder( s:String ) {
                                ^

/Volumes/1alic07/AC_WorkingFolder/Experiments/JSONExample/src/com/ adobe/serialization/json/JSONTokenizer.as(59): col: 19 Warning: The super() statement will be executed prior to entering this constructor. Add a call to super() within the constructor if you want to explicitly control when it is executed.

                public function JSONTokenizer( s:String ) {
                                ^

/Volumes/1alic07/AC_WorkingFolder/Experiments/JSONExample/src/com/ adobe/serialization/json/JSONToken.as(52): col: 19 Warning: The super () statement will be executed prior to entering this constructor. Add a call to super() within the constructor if you want to explicitly control when it is executed.

public function JSONToken( type:int = -1 /* JSONTokenType.UNKNOWN */, value:Object = null ) {
                                ^

/Volumes/1alic07/AC_WorkingFolder/Experiments/JSONExample/deploy/ JSONExample.swf (4616 bytes)
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to