PDA

View Full Version : Binding: execute(false) does not work


knoepsche
07-09-2005, 09:48 AM
In my application there is a DataSet-Component and a DataHolder-Component. Both own a field 'result'. If I define between them an in/out-binding with action script there only works the function 'execute(true)'. The same function with an other parameter like 'execute(false)' does not. Anybody can help me? Some Example with my own formatter-class :

class ResultFormater extends mx.data.binding.CustomFormatter{
function format(rawvalue:Object):Object{
//return value is just to test the call of my formatter
var myobject:Object = {itemname:'format'};
return myobject;
}
function unformat(formattedvalue:Object):Object{
//return value is just to test the call of my formatter
var myobject:Object = {itemname:'unformat'};
return myobject;
}
}


formdatholder.result = {itemname:'holdername'}; //formdatholder is the DataHolder-Component and 'result' is from type Object
form_dat.result = {itemname:'datname'}; //form_dat is the DataSet-Component and 'result' is from type Object
var src = new EndPoint(); //new endpoint as binding-source
src.component = form_dat; //data-set is the endpoints component
src.property = "result"; //field 'result' is the endpoints property
var dest= new EndPoint(); //new endpoint as binding-destination
dest.component ="formdatholder"; //data-holder is the endpoints component
dest.property = "result"; //field 'result' is the endpoints property
//the binding is bidirectional with a custom formatter
resultbinding = new Binding(src, dest, {cls: mx.data.formatters.Custom, settings: {classname: "ResultFormater"}},is2way=true);

resultbinding.execute(false); //write source to destination (call 'format()' from ResultFormater)
Result==>form_dat.result.itemname == 'datname'
Result==>formdatholder.result.itemname == 'holdername'
resultbinding.execute(true);//write destination to source (call 'unformat()' from Result Formater)
Result==>form_dat.result.itemname == 'unformat'
Result==>formdatholder.result.itemname == 'holdername'