Note that there are some explanatory texts on larger screens.

plurals
  1. PODisplaying JSON in flash
    primarykey
    data
    text
    <p>I'm trying to pull data into flash using JSON but i keep getting this error</p> <pre><code>JSONParseError: Unexpected &lt; 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 jsonairtest_fla::MainTimeline/decodeJSON() at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at flash.net::URLLoader/onComplete() </code></pre> <p>even though i can runt the pp file in the browser and the ouput looks fine to me, i even tried calling up a txt file and that worked but i don't know what am i doing wrong here.</p> <p>Here is AS3 code</p> <pre><code> import com.adobe.serialization.json.JSON var loader:URLLoader = new URLLoader(); var request:URLRequest = new URLRequest(); request.url = "pull.php"; loader.load(request); loader.addEventListener(Event.COMPLETE, decodeJSON); function decodeJSON(event:Event):void{ var loader2:URLLoader = URLLoader(event.target); //trace(event.target.data); var People:Array = JSON.decode(loader2.data); trace(People[0].NETWORKNAME) ; trace(People[1].NETWORKNAME) ; } </code></pre> <p>PHP code:</p> <pre><code> &lt;?php $host="localhost"; $user=""; $password=""; $database="db name"; $tablename="table name"; header('Content-type: application/json'); if(!$connection = mysql_connect($host,$user,$password)) { //if connection not eastablished then display message and die $message = mysql_error(); //echo "$message&lt;br&gt;"; die(); }else // in case the connection is eastablished $message = "Connection eastablished....."; //echo"$message&lt;br&gt;"; mysql_select_db($database,$connection) or die("database not found"); $query = mysql_query("SELECT NETWORKNAME from $tablename); $returnArray = array(); while($row=mysql_fetch_assoc($query)) array_push($returnArray, $row); mysql_close(); echo json_encode($returnArray); ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload