PDA

View Full Version : Help with addEventListener to onResult PHPObject??


rabruni
01-05-2008, 05:01 AM
Hi all - happy new year!
I am in need of help and am an extreme beginner to AS.
below is a sample code snipet
<code>
import com.ghostwire.phpobject.*;
PHPObject.defaultGatewayKey = "key";
// CHANGE THIS TO WHATEVER SECRET KEY YOU SET IN config.php
PHPObject.defaultGatewayUrl = "http://devserver/ddv/server/Gateway.php";

function Get_Flds ()
{
_get_flds = this;
var prop:String = "init";
db1 = new PHPObject ("db1");
db1.get_fields_onResult = function (result)
{
trace(result);//returns data so far so good.
_get_flds.prop = result;
trace(_get_flds.prop);//still returns the correct data
};
db1.get_fields ("Debug_Pg", "Site_Db");//call to php
trace(_get_flds.prop);//No data here???
}
var db_Pg = new Get_Flds ();

<code>
So I beleive the reasone the last trace is not being populated is because PHP has not returned the results.
So I am looking for any help on how I might rewrite this with some sort of event handler so I can better use the data. I have done a bit of research but I am not clear.
I am under a bit of a deadline so any help would be appreciated.
I am sure this has been covered and I have been on this for over a week.
thanks all for this and all the great posts.
PS. This is not the only way I have tried to do this but I have never been able to get an evenListener to work.
I included this code incase a listener is not the right way to go.