Quantcast
Channel: Adobe Community : All Content - Adobe Animate CC - General
Viewing all articles
Browse latest Browse all 13519

JSON

$
0
0

Am using the example for JSON http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/JSO N.html

 

When making up the .js file (Dreamweaver) it shows the "fruits": as an error. Unfamiliar with .js so not aware if this is the error

Without the : the error dissappears - but does not effect the results...

 

Am using the following:

var loader:URLLoader = new URLLoader();

AddJson();

 

function AddJson() {

          //loader set-up

          var request:URLRequest = new URLRequest("*****/test/fruit.js");

  loader.load(request);

          loader.addEventListener(Event.COMPLETE, jsonLoaded);

}

 

function jsonLoaded(event:Event):void {

          var jsonContent:URLLoader = URLLoader(event.target);

          //json

          var data:Object = JSON.parse(jsonContent.data);

          trace(data.fruits.length);

          trace("The first one is " + data.fruits[0].fruit + " : " + data.fruits[0].fruitcolor);

          var secondFruit:String = data.fruits[1].fruit;

          trace("secondFruit as string data: " + secondFruit)

}

 

and get this error:

Error #2044: Unhandled ioError:. text=Error #2032: Stream Error. URL: *****/test/fruit.js

          at Dictionary_fla::MainTimeline/frame1()[Dictionary_fla.MainTimeline::fr ame1:21]

 

I'm attempting to get mysql data from a php script returning json data, but thought to start with the example.

Would appreciate some pointers or a working example. Thank you


Viewing all articles
Browse latest Browse all 13519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>