Re: [flexcoders] Help with binding (flex 3)

2008-08-25 Thread Nik Derewianka
I have run into the same issue.  My RemoteObject calls are already set  
to makeObjectsBindable so that doesn't seem to be the issue.  
Basically, if i have a view that is already displaying the bound  
object, then do a remoteobject call that replaces the existing bound  
object with a new one, the bindings do not update.  Which makes sense  
as the replacement instance would not have the bindings of the current  
model object set on it.  Instead, I have resorted to copying the props  
over to the existing model object so that the bindings and references  
stay intact, using this script:


public class ObjUtil
{
import flash.utils.*;
public function ObjUtil()
{
}

public static function CopyProps(source:*,destination:*):void{
var def:XML = describeType(source);
var properties:XMLList = [EMAIL PROTECTED] + [EMAIL 
PROTECTED];
for each (var property:String in properties ) {
destination[property] = source[property];
}
}

}

And is used like this:

ObjUtil.CopyProps(e.result,userModel.currentUser);

It is not immensely robust and still feels like i am missing something  
in regards to binding - but this works without a whole bunch of extra  
typing for each and every property that needs to be updated.

Regards,
Nik


Re: [flexcoders] Help with binding (flex 3)

2008-08-24 Thread Josh McDonald
You need to set makeObjectsBindable on your WebService object.

-Josh

On Mon, Aug 25, 2008 at 1:22 PM, rss181919 [EMAIL PROTECTED] wrote:

 I have a value object that i cast as an object.
 public var MyObj:Object = new MyObj
 All of the properties of MyObj are bindable.

 I have a form item Text input object that is bound to one of the
 properties of MyObj.
 BindingUtils.bindProperty(MyTextInput, 'text', MyObj, 'Prop1');

 I have a web service that I need to update MyObj.  In my result
 handler I can set set each of the properties of MyObj directly from
 the result object.  When I do this, the binding work great and the
 MyTextInput text is updated automatically.

 The problem is, I would rather simply set the MyObj = event.result
 rather than copying over each individual property.  In testing, I
 find that I can set MyObj = event.result and then access the
 properties as expected.  For example

 Alert.show(MyObj.Prop1) //this returns the correct value.

 However, the binding to MyTextInput does not fire.  So MyTextInput is
 never updated.

 Any thoughts?



 

 --
 Flexcoders Mailing List
 FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
 Search Archives:
 http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
 Links






-- 
Therefore, send not to know For whom the bell tolls. It tolls for thee.

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED]


Re: [flexcoders] Help with binding (flex 3)

2008-08-24 Thread Sherif Abdou
I hope I am correct on this one, but I think the problem is the Object does not 
implement the IEventDispatcher Interface thus you can't do binding with an 
object. So maybe that is why?
  - Original Message - 
  From: rss181919 
  To: flexcoders@yahoogroups.com 
  Sent: Sunday, August 24, 2008 10:22 PM
  Subject: [flexcoders] Help with binding (flex 3)


  I have a value object that i cast as an object.
  public var MyObj:Object = new MyObj
  All of the properties of MyObj are bindable.

  I have a form item Text input object that is bound to one of the 
  properties of MyObj.
  BindingUtils.bindProperty(MyTextInput, 'text', MyObj, 'Prop1');

  I have a web service that I need to update MyObj. In my result 
  handler I can set set each of the properties of MyObj directly from 
  the result object. When I do this, the binding work great and the 
  MyTextInput text is updated automatically. 

  The problem is, I would rather simply set the MyObj = event.result 
  rather than copying over each individual property. In testing, I 
  find that I can set MyObj = event.result and then access the 
  properties as expected. For example

  Alert.show(MyObj.Prop1) //this returns the correct value.

  However, the binding to MyTextInput does not fire. So MyTextInput is 
  never updated.

  Any thoughts?