AMFPHP + onFault function

How are you supposed to use the onFault function with AMFPHP?
I'm trying to use "trigger_error($errormsg);". But the onFault
function in Flex 2 only prints [object Object].
So I have probably missunderstood the entire concept with the
onFault function.
Let's say I want to add something to a database, a user. I'll
send the username + email with my amfphp class. In that class I
have a function that checks if the username or the email already
exists, but how will I return the message to Flex 2 if one of them
already exists?
I thought the easiest way was to use: trigger_error("Username
exists"); and trigger_error("E-mail exists");. But that's useless
if you can't display the error msg in Flex 2.
Can someone help a complete beginner to flex 2 and amfphp
out?

I tried this function:
quote:
private function onFault(e:Object) : void
mx.controls.Alert.show(ObjectUtil.toString(e));
This will display this message in the alert box:
quote:
(Object)#0
code = "AMFPHP_RUNTIME_ERROR"
description = "Wrong username or password!"
details = "e:\projektmapp\Webb\annat\adobe flex 2
applicationer test\amfphp-1.9.beta\amfphp\services\userLogin.php"
level = "Unknown error type"
line = 37
But I want to display the "description" only.
If I try this function:
quote:
private function onFault(e:FaultEvent) : void
mx.controls.Alert.show(e.fault.faultString);
I'm getting an error when I run the application
quote:
TypeError: Error #1034: Type Coercion failed: cannot convert
Object@817dd81 to mx.rpc.events.FaultEvent.
Been trying to get this working for countless hours now, and
I can't figure it out :(
I'm triggering the error msg with this code in PHP
quote:
trigger_error("Wrong username or password!");

Similar Messages

  • Problem with AMFPHP

    Hi,
    I try to load function from PHP using AMFPHP in Flash. But Flash returns an error:
    Error #2044: Unhandled NetStatusEvent:. level=error, code=NetConnection.Call.Failed
    AMFPHP works correctly and I tested my PHP service in it -- it's OK. What can cause the problem?
    Here is my code:
    import flash.net.*;
    var gw:NetConnection = new NetConnection();
    gw.connect("http://localhost/amfphp/gateway.php");
    var responder:Responder = new Responder(onResult, onFault);
    function onResult(respond:Object)
    { trace(respond); }
    function onFault(error:Object) {
         for (var i in error)
         { trace(error[i]); }
    gw.call("Calc.add", responder, 2, 3);
    I work on localhost.

    Solved .
    I just needed to change
    define("PRODUCTION_SERVER", true);
    on
    define("PRODUCTION_SERVER", false);
    in gateway.php

  • Array Collection

    Hi,
    I'm using the following code in conjunction with amfPHP to pull information from a database, this info is then (as far as I know) returned to flex as an array collection.
    What I'm looking to do is populate the list with the data within the array collection,
    Heres my code
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
        <mx:Script>
            <![CDATA[
                import flash.net.*;
                import mx.collections.ArrayCollection;
                import mx.rpc.events.ResultEvent;
                public function connect():Object
                    var gw:NetConnection = new NetConnection();
                    gw.connect("http://localhost/amfphp/gateway.php");
                    var res:Responder = new Responder(onResult, onFault);
                    function onResult(responds:Object):void
                      trace(responds.serverInfo.initialData[0][1]);
                    function onFault(responds:Object):void
                        for(var i in responds)
                            trace(responds[i]);
                    gw.call("Test.getRecordset", res);
                    return res;
                public function init()
                    connect();
            ]]>
        </mx:Script>
        <mx:List x="75" y="113"></mx:List>
    </mx:Application>

    I've modified my code as follows,
    the idea being that when the user selects a category from the list, the tile list is populated with the icons, I can get this to poulate with the icon reference but can't actually get the icons to appear. Also for some reason when i select business, the communications results come up and vice versa
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="800" layout="absolute" creationComplete="init()">
        <mx:Script>
            <![CDATA[
                import flash.net.*;
                import mx.collections.ArrayCollection;
                import mx.rpc.events.ResultEvent;
    [Bindable]
                private var categoryResult:ArrayCollection;
    [Bindable]
                private var iconResult:ArrayCollection;
                public function getDistinct():Object
                var gw:NetConnection = new NetConnection();
                    gw.connect("http://localhost/amfphp/gateway.php");
                    var res:Responder = new Responder(onResult, onFault);
                    function onResult(responds:Object):void
                      categoryResult = new ArrayCollection(responds.serverInfo.initialData);  
                      //trace(arrResult); 
                    function onFault(responds:Object):void
                        for(var i in responds)
                            trace(responds[i]);
                   gw.call("Test.getDistinct", res);
                    return res;
                public function getIcons(cats:String):Object
                var gw2:NetConnection = new NetConnection();
                    gw2.connect("http://localhost/amfphp/gateway.php");
                    var res2:Responder = new Responder(onResult, onFault);
                    function onResult(responds2:Object):void
                      iconResult = new ArrayCollection(responds2.serverInfo.initialData);  
                      trace(iconResult); 
                    function onFault(responds2:Object):void
                        for(var i in responds2)
                            trace(responds2[i]);
                   trace(cats);
                   gw2.call("Test.getCategoryIcons", res2, cats);
                   return res2;
                public function init()
                    getDistinct();
                    getIcons("business");
               public function changeIcons(cat)
               trace(cat);
               getIcons(cat);
               iconTiles.dataProvider = iconResult;
               iconTiles.labelField = iconResult[0];
               iconTiles.iconField = iconResult[0];
            ]]>
        </mx:Script>
    <mx:List id="categoryList"
    width="150" x="75" y="113"
    dataProvider = "{categoryResult}" labelField="1"
    change="changeIcons(categoryList.selectedItem)" >
    </mx:List>
    <mx:TileList id="iconTiles"
    x="223" y="113" height="156"
    width="500"
    labelField=""
    ></mx:TileList>
    </mx:Application>

  • Problem with SOAP FAULT messages

    Hi,
    I'm developing the flash interface for a .NET application.
    The client side (flash) communicate with server side (.NET) by web
    services. The problem is that when the server side send a Fault
    message flash breaks telling "Unable to connect to
    endpoint........". In this case I need to know the error message
    send by the server but the fault.faultstring is undefined.
    Here the server Fault message:
    HTTP/1.1 500 Internal Server Error.
    Date: Wed, 23 Aug 2006 09:07:10 GMT
    Server: Microsoft-IIS/6.0
    X-Powered-By: ASP.NET
    X-AspNet-Version: 1.1.4322
    Cache-Control: private
    Content-Type: text/xml; charset=utf-8
    Content-Length: 419
    <?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope xmlns:soap="
    http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsi="
    http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="
    http://www.w3.org/2001/XMLSchema">
    <soap:Body>
    <soap:Fault>
    <faultcode>SoapHeader</faultcode>
    <faultstring>The userid: xxxx is
    invalid</faultstring>
    <detail />
    </soap:Fault>
    </soap:Body>
    </soap:Envelope>
    And this the code that handle the fault case:
    pendingcall.onFault = function (fault:Object){
    rootObj.gbl_logger.log("WS Fault: "+ fault.faultstring ,
    10);
    As you can see the real faultstring is "The userid: xxxx is
    invalid" but in the faultstring property of the fault object I
    found "undefined".
    I've read many posts that report that the problem can be
    solved in the server side modifing the HTTP HEADER from 500 to 200.
    Unfortunately I can't access the server side code. Exists a way to
    resolve the problem in the client side? Seems it is a Flash bug as
    the SOAP 1.1 specs tells that all SOAP Fault messages must carry a
    HTTP 500 header. Exists some patch that solve the problem?
    Thanks.

    Hi ,
    Thanks for joining the Community.
    Please get in touch so we can resolve this issue for you.
    Click here for contact details.
    Thanks
    James

  • ****Urgent**** Webservice Complex Type Handling ****Urgent****

    Hi kglad, am junior flash developer trying out webservices.
    So i was trying out a webservice "https://www.suhrkamp.de/webservice/suhrkamp_ws.cfc?wsdl"
    where i call getNews("webservicechef","remote147suhrkamp",41722) method.But even before the
    method is executed on the server i get an error of "Type apachesoap:Document not resolvable".From more research av come
    to knw tht the problem is that the service returns a complex type of apachesoap:Document
    which flash doesnt seem to understand.So how will i solve this....?
    my source is shown here below
    import mx.services.*;
    bt_Enter.clickHandler = function() {
        trace("Show invocation..");
        var q:String = input.text;
        //used to trace the actions from the cleint..
        stockServiceLog = new Log(Log.VERBOSE);
        stockServiceLog.onLog = function(txt) {
            trace(txt);
            disp.text = txt;
        /*var fault = function (stat) {
        trace("in fault..,");
            if (stat.code == "WebServiceFault"){
                trace(stat.data.faultcode);
                trace(stat.data.faultstring);
                trace(stat.data.detail);
        //Instanciating the web service..
        var stockservice = new WebService("https://www.suhrkamp.de/webservice/suhrkamp_ws.cfc?wsdl", stockServiceLog);
        //stockservice.addEventListener("status", fault);
        stockResultObj = stockservice.getNews("webservicechef","remote147suhrkamp","41722");
        trace("Requested XML: "+stockResultObj.request+" from  request");
        //stockservice.onLoad = trace("loading");
        // the onResult function is called if the service is successful
        stockResultObj.onResult = function(result) {
            trace(" result ok..");
            display.text=result;
            trace(result);
            trace("RequestXML: "+stockResultObj.request);
            trace("ResponseXML: "+stockResultObj.response);
        stockResultObj.onFault = function(fault) {
            trace(" on error  ok..");
            // If there is any error such as the service not working, the onFault handler will be invoked.
            trace(fault.faultCode+","+fault.faultstring);
            disp.text += fault.faultCode+","+fault.faultstring;

    Hi Sampath,
    Please check SAP note 1004108. I think the issue you describe is one of the limitations described in this note.
    Regards,
       Jan

  • Deserialize an array of objects from a web service

    Hi, I'm calling a webservice method which returns an array of
    objects (let's
    say classes called MyClass).
    I now want to define a class in actionscript called MyClass
    which matches
    the properties of the class defined in the web service
    (written in .NET),
    call the webservice method, and then deserialize the result
    in actionscript
    into an array of type MyClass.
    The code I have so far is:
    import mx.services.WebService;
    import mx.services.Log;
    var mylog:Log = new Log(Log.DEBUG);
    myLog.onLog = function(txt) {
    trace(txt);
    var ws:WebService = new WebService(wsc.WSDLURL);
    ws.onLoad = function(wsdl) {
    MyPendingCallObject =
    ws.CallTheWebServiceMethodWhichReturnsAnArrayOfMyClasses();
    MyPendingCallObject.onResult = function(result)
    trace(result);
    // HOW CAN I DESERIALIZE the result parameter into an Array
    of
    MyClass ???
    MyPendingCallObject.onFault = function(fault)
    trace('FAULT! ' + fault.faultCode + "," +
    fault.faultstring);
    // If the WSDL fails to load the onFault event is fired.
    ws.onFault = function(fault) {
    trace(fault.faultstring);
    TIA

    Hi,
    I posted a similar problem some time ago :
    http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=15&catid=294&threadid =1221565&enterthread=y
    Do you find any solution to your problem ?
    Fabrice

  • Auto-archiving streams with H.264 video

    My CDN is running FMS, and my customers and I stream a lot of live traffic through it. We've got FMS configured to auto-archive our live streams, but that only works for stream using VP6 video. When I look at the archived files captured from H.264 streams I get audio but no video.
    Is it possible to get FMS to autoarchive H.264 streams? Or is this planned for a future release of FMS?

    Yes, that does help, thanks!
    We do indeed have a script running to do our auto-archving. It currently doesn't recognize h.264, but with the info you provided I should be able to modify it to do so.
    What we are currently running is:
    * (C) Copyright 2007 Adobe Systems Incorporated. All Rights Reserved.
    * NOTICE:  Adobe permits you to use, modify, and distribute this file in accordance with the
    * terms of the Adobe license agreement accompanying it.  If you have received this file from a
    * source other than Adobe, then your use, modification, or distribution of it requires the prior
    * written permission of Adobe.                                                                
    * THIS CODE AND INFORMATION IS PROVIDED "AS-IS" WITHOUT WARRANTY OF                           
    * ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO                         
    * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A                              
    * PARTICULAR PURPOSE.                                                                         
    *  THIS CODE IS NOT SUPPORTED BY Adobe Systems Incorporated.                                  
    /* Adobe Flash Functions */                                                                    
    /* Load webservices.asc */
    load("webservices/WebServices.asc");
    trace(" * Loaded webservices/WebServices.asc");
    trace(" * Started Application");
    application.onConnect = function( client ) {
            /* Connection has started */     
            client.getStreamLength = function( streamName ) {
                    trace(" * Length => " + Stream.length( streamName ));
                    return Stream.length( streamName );               
            trace(" * Camera Connected");                             
            application.acceptConnection( client );                   
    application.onPublish = function (p_c, p_stream) {
            /* Publishing has started */           
            trace(" * p_c => " + p_c);             
            trace(" * p_stream => " + p_stream);   
            trace(" * Publishing started for stream " + p_stream.name);
            p_stream.archiveStart();                                
    application.onUnpublish = function (p_c, p_stream){
            /* Publishing has stopped */            
            trace(" * Publishing stopped for stream " + p_stream.name);
            p_stream.archive();                                     
    /* Our Custom Functions */
    /* Last Modified Tue Dec 1 2:55 pm */
    trace(" * Loading Custom Functions ... ");
    Date.prototype.unixTime = function () {
            /* Create and returl unix timestamp */
            trace(" * Getting UNIX Timestamp ... ");
            return Math.round(this.getTime() / 1000);
    Stream.prototype.archiveStart = function() {
            /* Start archiving stream */     
            this.record(); // start recording live stream
            trace(" * Recording started for stream");          
            this.startTime  = (new Date()).unixTime();
            // attach start time in unix time to object
    Stream.prototype.archive = function() {
            trace(" * Function => Stream.prototype.archive");
            this.record(false);
            // stop recording live stream                                                                                                                                                                                                              
            trace(" * Setting this.record to false");                                                                                                                                                                                         
            f = "/streams/_definst_/" + this.name + ".flv";
            // current name of file that was recorded                                                                                    
            trace(" * f => " + f);                                                                                                                                                                                                            
            src             = new File(f); // create a new file object of for sourse                                                                                                                                                                                                  
            if(src.exists){
                    /* src file exists */
                    trace(" * Src for " + f + " exists");
                    /* Create new unique name for recorded stream */
                    f1 = '/streams/_definst_/live_event_archives/auto_archive_' + this.name + '_'  + this.startTime + ".flv";
                    trace (" * New file name => " + f1);
                    /* Copy src file to new file */
                    try{
                            src.copyTo(f1);
                            trace(" * Copied src to " + f1);
                    catch(error){
                            trace(" * ERROR copying src to " + f1 + ": " + error.message);
                    /* Remove src file */
                    try{
                            src.remove(); // remove source file
                            trace(" * Removed src");
                    catch(error){
                            trace(" * ERROR deleting file: " + error.message);
                    /* Make web service request to vod server */
                    trace(" * Preparing to send to vod server ... ");
                    this.sendToVOD(this.name,f1,this.startTime,new Date().unixTime());
            else{
                    trace(" * ERROR! Src does not exist! " + src);
    Stream.prototype.sendToVOD = function(n,f,s,e) {
            trace(" * Preparing to submitting data to vod server ... ");
            trace(" * n => " + n );
            trace(" * f => " + f );
            trace(" * s => " + s );
            trace(" * e => " + e );
            /* URL for web service call */
            var cst_url = "http://cst.{OUR DOMAIN}.net/gateway/point/?name=" + n + '&file=' + f + '&start=' + s + '&end=' + e;
            trace(" * URL => " + cst_url);
            /* Init new webservice url call */
            var web = new WebService(cst_url);
            /* Make web service request */
            web.onLoad = function(wsdl){
                    trace(" * Connected to vod web service");
            web.onFault = function (wsdl){
                    trace(" * Could not connect to vod web service!");
    So, I will see if I can't modify it to decide whether it need to do mp4 or flv, and see if that helps.

  • Flex/AMFPHP App NOT working in IE but works in FireFox...

    Hello I am beginning to develop Flex applications. I am
    working with PHP in a Symfony environment.
    The error below was appearing before in FireFox but
    disappeared after I uninstalled the Flash Player plugin and
    reinstalled the Flash debug player for FireFox. I also uninstalled
    the IE Flash Player and replaced it with the Flash debug player for
    IE (i believe it comes with Active X). I have the exact same
    version of Flash player for both browsers, 0.0.47.0). This is the
    error:
    [object RemotingConnection]
    Error #2044: Unhandled NetStatusEvent:. level=error,
    code=NetConnection.Call.BadVersion
    at sample/initApplication()
    at sample/___Application1_creationComplete()
    at
    flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.core::UIComponent/set initialized()
    at mx.managers::LayoutManager/::doPhasedInstantiation()
    at Function/
    http://adobe.com/AS3/2006/builtin::apply()
    at mx.core::UIComponent/::callLaterDispatcher2()
    at mx.core::UIComponent/::callLaterDispatcher()
    Again this error was appearing in FF before but now ONLY on
    IE. The same error arrises if I try to open the SWF file localed in
    the bin/ directory in the Flex project. My flex project is located
    on my Desktop and the server I am trying to connect to is on a
    Linux box. AGAIN, this project displays the data perfectly on FF
    but NOT on IE. It just displays several rows from a DB table in a
    datagrid in Flex.
    I have no idea how to approach this! Here is my ".mxml" file:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    xmlns="*" creationComplete="initApplication()">
    <mx:DataGrid dataProvider="{phpData}">
    <mx:columns>
    <mx:DataGridColumn headerText="User ID"
    dataField="userid"/>
    <mx:DataGridColumn headerText="User Name"
    dataField="username"/>
    <mx:DataGridColumn headerText="Email Address"
    dataField="emailaddress"/>
    </mx:columns>
    </mx:DataGrid>
    <mx:Script>
    <![CDATA[
    [Bindable]
    public var phpData:Array;
    import flash.net.Responder;
    public var gateway:RemotingConnection;
    public function initApplication():void
    gateway = new RemotingConnection("
    http://project_dev_environment/web/backend_dev.php/gateway/amfphp");
    gateway.call("Sample.getUsers", new Responder(onResult,
    onFault));
    public function onResult(result:Array):void
    trace(phpData);
    phpData = result;
    public function onFault(fault:String):void
    trace(fault);
    ]]>
    </mx:Script>
    </mx:Application>
    Here is the required ".as" file:
    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
    I have given a differnt URL because this is an internal
    application and wont be accessible by outside users.
    Again, this app works when loaded on FF but not IE! HELP
    please I have been trying to figure this out since 7 am this
    morning and I'm desperate!
    Just FYI AMFPHP is set up correctly, although its version 1.2
    - could this be causing problems?
    Please, PLEASE help me! or at least a hint. Thank you!

    Hey Tikis,
    There are a few factors that could be throwing this thing
    through a loop. I've had this exact same thing happen to me once
    before and the culprit for me was that my crossdomain.xml file
    wasn't 100% perfectly formed. Apparently Firefox didn't care enough
    and went on with it's life however IE decided it wasn't going to
    read it and I received that error, so that would be the first thing
    I would check.
    The next thing is what version of PHP are you running on the
    server, it seems to me that the newest release of 5.2.2 is throwing
    this error more often then ever before, something I might suggest
    is upgrading to AMFPHP 1.9. RemoteObjects natively send data in
    what's called the AMF3 format which is much speedier then it's
    predecessor of AMF0. Only AMFPHP 1.9 has the ability to receive /
    send the data back in AMF3 format, where as with the 1.2 version
    it's sending the call, converts it down to AMF0 sends the data (at
    a slower pace) and generates a result. The other advantage to being
    able to use AMF3 is having true type casted results such as if PHP
    returns a number you can check it by if(event.result == 0) where as
    AMF0 everything is converted into a string and then sent back to
    Flash / Flex. So aside from all of these advantages the last one is
    less code, you no longer need to use the RemotingConnection to
    convert everything down to AMF0. I would make a copy of amfphp on
    your linux of the 1.9 version and send the remote object at that
    first and see what happens, if you are still receiving the same
    error then the problem lies in something else.
    Hope this helps.

  • Fairly certain that FileStream.writeObject() and FileStream.readObject() do not function - at all -.

    I've struggled with this since Jan 9th, 2013 (if not longer) and the only conclusion I can come to is that this simply does not function.  No matter what I try and no matter what resource (and I'm finding precious few) I follow to try to implement this within Flash Builder 4.7, Flex SDK 4.6.0 (Build 23201), AIR SDK 3.5, I only succeed in creating a file (with the correct name) that is 123 bytes in size that reads back in as NULL;
    I've tried using ByteArray.writeObject()/readObject() as an intermediary with FileStream.writeBytes()/readBytes(), with no luck.
    I've tried instantiating an object, setting properties and then using that.  I've tried instantiating my correctly formed ValueObject (including the remoteClass alias metadata tag).
    I've tried using -verbatim- the example provided in the top most suggested 'Community Help' resource http://www.switchonthecode.com/tutorials/adobe-air-and-flex-saving-serialized-objects-to-f ile It is worth noting that this solitary example of the procedure/SDK-usage is dated to Flex SDK 3.0 and at least 04/04/2009 (first comment on the article).
    My frustrating hell (one version of many methods attempted) is detailed on StackOverflow (including -all- mxml, as, and trace output), but so far, no assistance has been forthcoming, alas.  This is a severely stripped down and simplified version of what had been a far more complex attempt:
    http://stackoverflow.com/questions/14366911/flex-air-actionscript-mobile-file-writeobject- readobject-always-generates-null-w
    An earlier post* detailing a far more complex attempt interation, with, alas, just as little help (guess this isn't a hot button topic) forthcoming:
    http://stackoverflow.com/questions/14259393/flex-actionscript3-filestream-writeobject-fail s-silently-in-ios-what-am-i-doin
    * I previously suspected that it was only failing from within iOS on an iPad, but the first example (the stripped down version) made it evident that it didn't work in the AIR mobile device simulator (iPad) in the Windows environment, and indeed, didn't work in a non-mobile project in the windows environment AIR launcher.
    I'm at a loss, upset, frustrated, in major trouble with my supervisor/deadlines, etc.
    I would very much appreciate any suggestions/help/confirmation/etc.
    Just to move ahead with development I've opted for a far less preferable solution of writing out both an XML file and a JPG file.  I very much do not like this and very much want to store encapsulated serialized objects locally in the same way I assume will work for storing remotely with AMFPHP (if the project ever gets to that point *sigh*).
    Again.  Would be so grateful for any help.

    I want to add to this post as I marked it as "The Answer" though it does not indeed contain the answer directly, for those who come looking for simliar solutions.
    harUI prompted me to realize that my metadata term needed to be capitalized (RemoteClass instead of remoteClass).  As the metadata tags may be user defined, the compiler throws no errors (or warnings *grumble*)
    package vo
        import flash.display.BitmapData;
       // [remoteClass(alias="PTotmImageVO")] incorrect
       [RemoteClass(alias="PTotmImageVO")]
        public class PTotmImageVO

  • Display results of MySQL query from AMFPHP by ArrayCollection in AS3 (Flash CS4)

    Hi, i am using Flash CS4 (AS3) + AMFPHP + MySQL to do own flash frontend for Wordpress CMS.  Everything is going fine but i`ve got one problem. Problem with properly display of result of query in AS3 by using ArrayCollection.
    When i check my service in "amfphp/browser/" in web browser i`ve got this (with all needed data):
    (mx.collections::ArrayCollection)#0
    filterFunction = (null)
    length = 2
    list = (mx.collections::ArrayList)#1  
    length = 2     source = (Array)#2
    That is the reason that i suppose that service work fine.  Problem is when i try to display result in AS3. In actionscript i have got this:
    function getNewsListHandler(result:Object):void{
    trace(result);
    This function displays: [object Object].
    I know that "result" is an ArrayCollection type but i don`t know how to get rows and columns from this. I know that my data is there but i have no idea how to get it.
    Clarify: I don`t know how to get to Arrays and simple data variables which are in ArrayCollection.
    Could anyone help me with that problem. I would be gratefull
    P.S. I tried also change query type in service.PHP for mysql_fetch_query but in that case i`ve got only one row (not all data).

    Thanks for fast reply,
    arr_coll:ArrayCollection = new ArrayCollection ({col1:"data1",col2:"data2"}, {col1:"data3",col2:"data4"});
    you would get the data like
    var resultstr:String = arr_coll[1][1].col2;
    trace(resultstr);
    //results in data4
    could you explain me how it was happen (arr_coll[1][1].col2)? It`s not clear to me. I thought in this case rather something like this :
    var resultstr:String = arr_coll[1]['col2'];
    It should give me "data4". I know it wasn`t but i don`t understand ArrayCollection in level which is needed to use your advice in my case. Could you clarify "arr_coll[1][1].col2" a bit?
    What would it look like when you would have something like this:
    arr_coll:ArrayCollection = new ArrayCollection ({col1:"data1",col2:"data2"}, {col1:"data3",col2:"data4"},{col1:"data5",col2:"data6"},{col1:"data7",col2:"data8"});
    and you would want know f.e. position in ArrayCollection of  "data6". How would you code this? arr_coll[1][2].col2?

  • AMFPHP hanging in browser but not Flash IDE?

    Wrote a service that sends a bytearray to my Flash app that works perfectly fine when I test it in the Flash IDE (CS5), and when I compile the app and run it in a browser directly from my computer.
    When I load it on to the server to run in my browser, the same service hangs. Can anyone think what may be causing this?
    I tested the service in the service browser and it worked fine there as well.
    I'm really hitting a wall on this, any help would be appreciated!

    What is ncDB? Is it a remote object?
    Remote object don't have a connect method. Istead you should set the endpoint, source and destination properties.
    If you handle your requests through AS3, you could do the following. I use this code in a singleton class.
    in the constructor:
    ws.RemoteObject = new RemoteObject();
    ws.destination = "amfphp";
    ws.source = "nameOfYourService";
    ws.endPoint = "linkToYourGateway.php";
    ws.addEventListener(FaultEvent.FAULT, this.faultHandler);
    In a method named 'call':
    public function call(endPoint:String = null, serviceMethod:String, resultFunction:Function = null, ...args):void
              if (endPoint != null)
                   ws.endPoint = endPoint;
                if (resultFunction == null)
                    resultFunction = defaultResult;
                if (ws.operations.hasOwnProperty(serviceMethod))
                    ws[serviceMethod].removeEventListener(ResultEvent.RESULT, resultFunction);
                    ws[serviceMethod].removeEventListener(ResultEvent.RESULT, defaultResult);
                ws[serviceMethod].addEventListener(ResultEvent.RESULT, resultFunction);
                ws[serviceMethod].arguments = args;
                ws[serviceMethod].send();
    Does this help?
    Dany

  • How to use AMFPHP Objects in Flex

    Hi,
    I have been successful in getting amfphp to return PHP objects, the question now is how can I make Flex aware of the objects?
    I am invoking a remote object and the objects are returned as a result. Can they be used directly or should I use XML?

    Hmm, your code seems a bit to complicated. Here's what I do:
    The RemoteObject:
    <mx:RemoteObject id="PHPGateway" source="yourAMFPHPClassName.ThePHPFile" destination="amfphp" showBusyCursor="true">
        <mx:method name="theFunctionYouWantToCall" result="myFunctionResultHandler(event)" fault="myFunctionFaultHandler(event)"/>
    </mx:RemoteObject>
    Observations:
    1. yourAMFPHPClassName is the name of the folder in amfphp\services that contains the PHP classes.
    2. ThePHPFile is the PHP class file (without the extension) in the yourAMFPHPClassName folder.
    3. You need the <mx:method name="..." .../> to define the function in the PHP class you want  to call. The theFunctionYouWantToCall must be the exact name of the function in the PHP class (case sensitive).
    The ActionScript part:
    //THE BELOW EXAMPLE ONLY WORKS IF THE PHP FUNCTION RETURNS A SINGLE VALUE
    //This means the PHP function has a return statement like this: return $value; or return "Test";
    private function myFunctionResultHandler(event:ResultEvent):void
    var PHPResult:String=String(event.result);
    Alert.show(PHPResult);//will show what the PHP class returned
    //THE BELOW EXAMPLE SHOWS HOW TO PASS MULTIPLE DATA TO FLEX
    //This means the PHP function has a return statement like this:
    //$returnValue=array();
    //$returnValue['name']="George";
    //$returnValue['age']=$age;
    //return $returnValue;
    private function myFunctionResultHandler(event:ResultEvent):void
    Alert.show("Name: "+event.result.name);
    Alert.show("Age: "+event.result.age);
    //THE FAULT HANDLER
    private function myFunctionFaultHandler(event:FaultEvent):void
    Alert.show("Data could not be acquired.");

  • Trouble calling functions in PHP

    I am trying to get around this problem that I have been stuck
    on so as to call a function in the $videoSQL list that uses an
    array list from a database. Any help would be appreciated.

    you can use AMFPHP. here is an artile which leads to a pdf explanation:
    http://blogs.adobe.com/mikepotter/2006/02/flex_and_php_us.html
    or you can google.

  • AMFPHP - Sending data to Flex

    Since i start using AMFPHP, i've been seeing different ways to send data to Flex, two of them is sending an ArrayCollection containing all the data another way is using VO's, or sending objects each one with one row of my query (am i correct?).
    Now, what's the difference between sending the query results in an ArrayCollection (1000 records means 1 ArrayCollection) and sending a bunch of objects (1000 records means 1000 objects) to Flex with RemoteObject?
    Sending an ArrayCollection the data goes like this:
      [0] (Object)#1
        color_code = "0x9999"
        color_id = "8"
      [1] (Object)#2
        color_code = "0xCC99CC"
        color_id = "7"
      [2] (Object)#3
        color_code = "0xFF9999"
        color_id = "10"
      [3] (Object)#4
        color_code = "0xFFCC66"
        color_id = "9"
    And the PHP code is this one:
    public function all_colors_array(){
         $db=$this->connection();
         $rs=$db->Execute("SELECT * FROM colors WHERE color_status=1 ORDER BY color_code ASC");
         $i=0;
         while (!$rs->EOF){
              $color_code[$i]['color_id'] = $rs->fields['color_id'];
              $color_code[$i]['color_code'] = $rs->fields['color_code'];
              $rs->MoveNext();
              $i++;
         return $color_code;
    Sending as Objects, it goes like this:
      [0] (Object)#1
        color_code = "0x9999"
        color_id = "8"
        color_status = "1"
      [1] (Object)#2
        color_code = "0xCC99CC"
        color_id = "7"
        color_status = "1"
      [2] (Object)#3
        color_code = "0xFF9999"
        color_id = "10"
        color_status = "1"
      [3] (Object)#4
        color_code = "0xFFCC66"
        color_id = "9"
        color_status = "1"
    And the PHP is like this after including the VO file:
    include_once '../vo/ColorVO.php';
    .......public function all_colors_objects(){
         $db=$this->connection();
         $rs=$db->Execute("SELECT * FROM colors WHERE color_status=1 ORDER BY color_code ASC");
         while (!$rs->EOF){
              $color = new ColorVO();
              $color->color_id = $rs->fields['color_id'];
              $color->color_code = $rs->fields['color_code'];
              $color->color_status = $rs->fields['color_status'];
              $a[]=$color;
              $rs->MoveNext();
    return $a;
    Now:
    1. What's the difference?
    2. Which one is best pratices?
    3. Which one is better? ans Why?
    4. If is there anything wring with my code please fell free to correct it!!

    i dont know why.. Adobe Forum is just banned my account !!! :O
    and..to your answer... well, i never tried MS sql to connect to flex.
    but you may check this:
    http://livedocs.adobe.com/flex/3/html/help.html?content=data_access_2.html
    thank you.

  • Amfphp - flex remote object error event handler

    I'm using amfphp and I want it to return an error that the flex remote object error event handler will pick up. At the moment I can get only the result handler to do anything in flex.

    Hi,
    Try throwing an exception in the remote method. For example,
    function inverse($x) {
        if (!$x) {
            throw new Exception('Division by zero.');
        else return 1/$x;

Maybe you are looking for

  • How to obtain the timestamp of a schedule for which I get the details?

    Please find below the extract from documentation showing the syntax of XML returned by the Web Services call. What is missing for me, is the timestamp. I wonder if you guys encountered this and have any idea how to obtain this (timestamp) information

  • Windows 8.1 upgrade on my W520

    Ever since upgrading to windows 8.1, i I had an issue where I couldnt run any Windows 8 modern applications. Everytime I click on any of the applications, it would look like its starting with the usual "flip 360 animation" and then immediatly close.

  • Where can I find a print driver compatible with OS 10.7 for USB HP LaserJet P1006?

    Where can I find and download a print driver compatible with OS 10.7.5 on iMac for USB HP LaserJet P1006? Ran software update. Apple notes that a driver is unavailable, consult HP (who seems to offer only info but no software download available). Any

  • IE8 script error while installing Flash Player

    [WinXP (2002) SP3] Installation of Flash Player 11 (tried this 10 or more times) is interrupted by an IE8 script error message "Object doesn't support this property or method" (Line: 207 Char: 1 Code: 0 URL: http://www.adobetag.com/d1/adobe/live/geta

  • DSO Activation duration / monitoring

    Hi, in english: During the activation-process I like to know how long the rest of the activation process will last. This should be displayed either in percentage of the total amount or in minutes or hours. I found a couple of similar questions in the