good day,
I've got this class that uses lcds to query a clob in an oracle db we're using lcds & fiber with rtmp to push changes to all the clients and then display the changes to screen. I can see the pushed updated data coming in to clients (with trace turned on in the debugger) and the ourMl/lastResult shows the updated record but the propertychange (on the [bindable] ) or the changewatcher events don't seem to be firing. what am I doing wrong?
I've tried a bunch of different things here is the current code:
package our.funcs
{
import hut.Ourml;
import hut.OurmlService;
import flash.events.Event;
import flash.events.TimerEvent;
import flash.utils.Timer;
import mx.binding.utils.ChangeWatcher;
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.rpc.CallResponder;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import org.osmf.events.TimeEvent;
/// standard class to work with ourml stored in the db
public class wrOURML
{
[Bindable]
public var _ourml:Ourml;
// setup up own responder & service
private var getOc:OurmlService = new OurmlService();
private var cal:CallResponder = new CallResponder();
private var callBack:Function; // set up the caller to point to this record when query completes
private var octype:String;
private var _asXML:XML; // this is the xml being changed...
//[Bindable]
public var asString:String;
private var inited:Boolean = false;
public function wrOURML(OURType:String, callFunc:Function)
{
trace("wrOURML called for " +OURType);
if (OURType == null || OURType.length == 0) {
return ;
}
// setup for db call
// put on responders not the service
//cal.addEventListener(ResultEvent.RESULT, gotResp, false,0,false);
//cal.addEventListener(FaultEvent.FAULT, gotError, false,0,false);
cal.addEventListener(ResultEvent.RESULT, gotResp);
cal.addEventListener(FaultEvent.FAULT, gotError);
cal.token = getOc.getByOurtype(OURType);
callBack = callFunc; // remember the params
octype = OURType;
}
private function ocChanged(e:Event) : void {
trace("ourml changed called");
}
private function calChanged(e:Event) : void {
trace("cal changed called");
}
private function updResp(event:ResultEvent) :void {
trace("update result called");
}
private function gotResp(event:ResultEvent) :void {
trace("wrOURML got resp called for " +octype + " event = " + event.result.toString());
if (cal.lastResult != undefined && (cal.lastResult as ArrayCollection).length > 0) {
_ourml = ((cal.lastResult)[0]) as Ourml;
trace("wrOURML resp for " +octype + " is " + _ourml.ourtype);
ChangeWatcher.watch(this,"_ourml",ocChanged);
ChangeWatcher.watch(cal,"lastResult",calChanged);
//cal.removeEventListener(ResultEvent.RESULT,gotResp);
//cal.addEventListener(ResultEvent.RESULT,updResp);
}
else {
// set up as initial record
trace("wrOURML creating new record " +octype);
_ourml = new Ourml();
_ourml.ourtype = octype;
_ourml.our = "<"+octype+"/>";
}
_asXML = new XML(_ourml.our); // convert for users and use this for changes
asString = _ourml.our;
if (!inited) { // updates pass through here ...
inited = true;
callBack(_asXML); // now set up who is interested
}
}
/// run all upudates through here
public function save() : void {
trace("wrOURML save called");
_ourml.our = _asXML.toXMLString(); // fold it back into a string
asString = _asXML.toXMLString(); // fold it back into a string
if ( _ourml.id > 0) // is it an update or new record
getOc.updateOurml(_ourml);
else
getOc.createOurml(_ourml);
}
// TODO handle error
private function gotError(event:FaultEvent) :void {
trace("Query failed");
}
// let the outside see these...
public function get ourml () :Ourml {
return _ourml;
}
public function set ourml ( value:Ourml) : void {
_ourml = value;
}
public function get asXML () :XML {
return _asXML;
}
public function set asXML ( value:XML) : void {
_asXML = value;
}
}
}
Views
Replies
Total Likes
after googling some more and finding the answer in a similar problem this worked:
ChangeWatcher.watch(this,["_ocdml","version"],ocChanged);
with
[Bindable]
var _ocdml:Ocdml;
Views
Replies
Total Likes