1 Reply Latest reply on Dec 18, 2008 2:03 PM by Newsgroup_User

    Waiting for a property to change

    SiHoop Level 1
      I'm trying to create a class to return data from a database. The class returns a value before its value has changed. How can I get the class to wait?
        • 1. Re: Waiting for a property to change
          Level 7

          "SiHoop" <webforumsuser@macromedia.com> wrote in message
          news:gidun4$f1g$1@forums.macromedia.com...
          > I'm trying to create a class to return data from a database. The class
          > returns
          > a value before its value has changed. How can I get the class to wait?
          >
          > package{
          > public class ImportText {
          >
          > import mx.rpc.events.ResultEvent;
          > import mx.rpc.http.HTTPService;
          > private var service:HTTPService;
          > public var returnVal:String
          > private var params:Object = new Object();
          >
          > public function ImportText(_value:String, _url:String):void{
          > params.passageId = _value
          > service = new HTTPService();
          > service.url = _url;
          > service.method = "GET";
          > service.addEventListener("result", httpResult);
          > service.send(params)
          > trace("returnVal1="+returnVal)
          > }
          > public function httpResult(event:ResultEvent):String{
          > returnVal=event.result.returnVal
          > trace("returnVal2="+returnVal)
          > return returnVal
          > }
          > }
          > }

          Are you saying that the httpResult function gets called before there's a
          result?

          I'm not clear on what the problem is here.
          >