|
Error #2044: Unhandled NetStatusEvent:. level=error,
code=NetConnection.Call.BadVersion at
remoting/initApplication() at
remoting/___Application1_creationComplete() at
flash.events::EventDispatcher/dispatchEvent() at
mx.core::UIComponent/set initialized() at
mx.managers::LayoutManager/::doPhasedInstantiation() at
mx.core::UIComponent/::callLaterDispatcher2() at
mx.core::UIComponent/::callLaterDispatcher() ///////////////////////// Mxml Page named remoting.MXML//////////////// <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns="*" creationComplete="initApplication()" > <mx:Script> <![CDATA[ import
mx.messaging.messages.RemotingMessage; import
mx.collections.ArrayCollection; import
mx.rpc.remoting.RemoteObject; [Bindable] public
var albums:ArrayCollection; [Bindable] public
var dataProvider:Array; public
var gateway : RemotingConnection; public
function initApplication():void { gateway
= new RemotingConnection(
"http://www.t8clients.com/fieldlink/flashConn/gateway.php" ); gateway.call("HelloWorld.getUOMTypes",
new Responder(onResult, onFault)); } public
function onResult( result : Array ) : void { albums
= new ArrayCollection(result); //dataProvider
= result; } public
function onFault( fault : String ) : void { trace(
fault ); } ]]> </mx:Script> <mx:ComboBox
x="68" y="20" id="listOfAlbums"
dataProvider="{albums}" labelField="title"> </mx:ComboBox> </mx:Application> ////////////////////////////////////////////////////////////////////////////////////HelloWorld.php///////////////////////////////////////////// <?php require_once('DB.php'); require_once('DBManager.php'); class HelloWorld extends DBManager { function HelloWorld() { $this->DBManager(); $this->methodTable = array(
"getUOMTypes" => array(
"description" => "Returns the contents of the uom_type
table",
"access" => "remote",
"arguments" => null,
"return" => "RecordSet" ), ); } function getUOMTypes() {
$arr= array(1);
$qry = "select uom_type_id, name from uom_type where uom_type_id =
?";
$prep = $this->db->prepare($qry);
$res = $this->db->execute($prep, $arr);
if (PEAR::isError($data)) {
die($data->getMessage());
}
$results = array();
while ($res->fetchInto($row)) {
// Assuming DB's default fetchmode is DB_FETCHMODE_ORDERED
$results[$row[0]] = $row[1];
}
return $results; } } /* $myHelloWord = new HelloWorld; $result = $myHelloWord->getUOMTypes(); print_r($result); */ ?> //////////////////////// RemotingConnection.as
/////////////////////////////////////////////////////////////////////////////// package {
import flash.net.NetConnection;
import flash.net.ObjectEncoding;
public class RemotingConnection extends NetConnection {
public function RemotingConnection( sURL:String )
{
objectEncoding = ObjectEncoding.AMF0;
if (sURL) connect( sURL );
}
public function AppendToGatewayUrl( s : String ):void
{
//
} } } ///////////////////////////// -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
YAHOO! GROUPS LINKS
|

