Hi all,

I'm having problems with refercencing data records from a php file. The
php and flash remoting is working fine and when i uncomment the log code:
//myLogger = new Log( Log.DEBUG, "logger1" ); in the Actionscript class
file it will output all the results from the database. The problem i'm
having is referencing the data in the actionscript (Class File). Please
see the code below:

newsContent.as:

import mx.remoting.Service;
import mx.services.Log;
import mx.remoting.PendingCall;;
import mx.rpc.RelayResponder;
import mx.rpc.FaultEvent;
import mx.rpc.ResultEvent;
import mx.remoting.debug.NetDebug;
//
class com.website.news.newsContent {

private var myService:Service
private var body_txt:TextField
private var init:Boolean
private var myLogger:Log
private var getItems_rs
private var temp:String
private var listwindow_mc

//Constructor
//Responder function for onResult event
function newsContent(getItems_rs){
NetDebug.initialize() 
//myLogger = new Log( Log.DEBUG, "logger1" );
myService = new Service("http://www.domain.com/gateway.php";,
myLogger,
"newsService",
null,
null);
} 
//Public methods
public function getItems(getItems_rs:String):Void {
var pc:PendingCall = myService.getItems(getItems_rs)
pc.responder = new RelayResponder(this, "getItems_onResult",
"getItems_onFault" );
}
//Private methods
private function getItems_onResult(res_rs:ResultEvent):Void{
NetDebug.trace( { level: "debug", message: "There�s a result: "})
//This is where the error is occuring, it's not referencing the data which
is produced by the php:
body_txt.text = String(res_rs.result);
trace(String(res_rs.result)); //traces [object Object]
}
private function getItems_onFault(e:FaultEvent):Void{
NetDebug.trace( { level: "debug", message: "There was a problem: " +
e.fault.faultstring})
}
}

// End of AS Class

Here is the php that is working fine:

<?php
class newsService {
function newsService() {
$this->methodTable = array(
"getItems" => array(
"description" => "New results",
"access" => "remote",
"roles" => "role, list",
"arguments" => array ("day")
),
);
$this->conn = mysql_connect("localhost","database","password");
mysql_select_db ("database");
}
function getItems($startingRecord){
return mysql_query("SELECT id,news_date,news_title FROM table WHERE
is_preview=0 order by id DESC LIMIT $startingRecord , 20");
}
}
?>
//End of PHP Class

Here is the timeline code to reference the newsContent Class file:

import com.website.news.newsContent;
conn = new newsContent(this); 
conn.getItems(4);

Thanks in advance.

Jake

---
You are currently subscribed to fugli as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/

Reply via email to