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

2008-08-26 Thread Josh McDonald
myobj(event.result) won't give you null. (event.result as Myobj) might, but
myobj(event.result) will give you a runtime exception.

On Tue, Aug 26, 2008 at 11:28 PM, rss181919 <[EMAIL PROTECTED]> wrote:

> Nik,
> Thanks for the object utility recommendation.  That seems to work for
> now although I agree with you that if I cast my object as object and
> then set it = to the event.result instance, flex should update the
> binding.  Maybe we are just missing something in the design.
>
> Anyway, I wanted to point out that the code you provided was helpful
> but I had to change the 1st line of the CopyProps function to use the
> destination and not the source.
>
> Thanks again.
>
> --- In flexcoders@yahoogroups.com, "Josh McDonald" <[EMAIL PROTECTED]> wrote:
> >
> > I see your problem I think. Are you setting component.datasource =
> > resultEvent.result through actionscript somewhere? That won't get
> updated
> > when you make another service call, because a new result object is
> created.
> > If you bind to service.lastResult (or something, I don't do it that
> way)
> > instead, it should work. Once you set something manually without
> using
> > bindings, you can't get updates if that whole object is replaced.
> >
> > -Josh
> >
> >
> > On Tue, Aug 26, 2008 at 1:14 AM, rss181919 <[EMAIL PROTECTED]> wrote:
> >
> > > I get the same result.  As long as I copy the event.result
> properties
> > > over to my custom property, I get binding, but trying to set it to
> > > the object causes binding to fail even though the object
> properties
> > > transfer over to the custom property successfully.
> > >
> > > I set my webservice to makeObjectsBindable but this does not seem
> to
> > > help.  I also declare my storage object as bindable.  I read the
> > > recommendation about the IEventDispather but if the object and the
> > > properties have already been tagged as bindable and setting the
> > > properties directly causes binding, i dont think implementing
> > > IEventDispatcher will be a difference.
> > >
> > > Any other thoughts on this?  I could write a script to copy the
> > > properties over but i believe flex should do this and i would
> rather
> > > let flex handle it if it can.
> > >
> > >
> > > --- In flexcoders@yahoogroups.com, Nik Derewianka 
> wrote:
> > > >
> > > > 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
> > > >
> > >
> > >
> > >
> > > 
> > >
> > > --
> > > 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]
> >
>
>
>
> 
>
> --
> 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 PR

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

2008-08-26 Thread rss181919
Nik,
Thanks for the object utility recommendation.  That seems to work for 
now although I agree with you that if I cast my object as object and 
then set it = to the event.result instance, flex should update the 
binding.  Maybe we are just missing something in the design.

Anyway, I wanted to point out that the code you provided was helpful 
but I had to change the 1st line of the CopyProps function to use the 
destination and not the source.  

Thanks again.

--- In flexcoders@yahoogroups.com, "Josh McDonald" <[EMAIL PROTECTED]> wrote:
>
> I see your problem I think. Are you setting component.datasource =
> resultEvent.result through actionscript somewhere? That won't get 
updated
> when you make another service call, because a new result object is 
created.
> If you bind to service.lastResult (or something, I don't do it that 
way)
> instead, it should work. Once you set something manually without 
using
> bindings, you can't get updates if that whole object is replaced.
> 
> -Josh
> 
> 
> On Tue, Aug 26, 2008 at 1:14 AM, rss181919 <[EMAIL PROTECTED]> wrote:
> 
> > I get the same result.  As long as I copy the event.result 
properties
> > over to my custom property, I get binding, but trying to set it to
> > the object causes binding to fail even though the object 
properties
> > transfer over to the custom property successfully.
> >
> > I set my webservice to makeObjectsBindable but this does not seem 
to
> > help.  I also declare my storage object as bindable.  I read the
> > recommendation about the IEventDispather but if the object and the
> > properties have already been tagged as bindable and setting the
> > properties directly causes binding, i dont think implementing
> > IEventDispatcher will be a difference.
> >
> > Any other thoughts on this?  I could write a script to copy the
> > properties over but i believe flex should do this and i would 
rather
> > let flex handle it if it can.
> >
> >
> > --- In flexcoders@yahoogroups.com, Nik Derewianka  
wrote:
> > >
> > > 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
> > >
> >
> >
> >
> > 
> >
> > --
> > 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]
>




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

2008-08-26 Thread rss181919
I am using an intermediate VO object (myobj) as my binding source.  
So basically, I have a form whose input fields are bound to myobj and 
then in my result handler for the webservice call i set myobj = to 
event.result.  I have 2 problems right now.  

1. var myobj:myobj = myobj(event.result) does not work.  returns a 
null.

2. var myobj:object = new myobj
myobj = event.result 
this works but then the form never updates because binding fails.  

--- In flexcoders@yahoogroups.com, "Josh McDonald" <[EMAIL PROTECTED]> wrote:
>
> I see your problem I think. Are you setting component.datasource =
> resultEvent.result through actionscript somewhere? That won't get 
updated
> when you make another service call, because a new result object is 
created.
> If you bind to service.lastResult (or something, I don't do it that 
way)
> instead, it should work. Once you set something manually without 
using
> bindings, you can't get updates if that whole object is replaced.
> 
> -Josh
> 
> 
> On Tue, Aug 26, 2008 at 1:14 AM, rss181919 <[EMAIL PROTECTED]> wrote:
> 
> > I get the same result.  As long as I copy the event.result 
properties
> > over to my custom property, I get binding, but trying to set it to
> > the object causes binding to fail even though the object 
properties
> > transfer over to the custom property successfully.
> >
> > I set my webservice to makeObjectsBindable but this does not seem 
to
> > help.  I also declare my storage object as bindable.  I read the
> > recommendation about the IEventDispather but if the object and the
> > properties have already been tagged as bindable and setting the
> > properties directly causes binding, i dont think implementing
> > IEventDispatcher will be a difference.
> >
> > Any other thoughts on this?  I could write a script to copy the
> > properties over but i believe flex should do this and i would 
rather
> > let flex handle it if it can.
> >
> >
> > --- In flexcoders@yahoogroups.com, Nik Derewianka  
wrote:
> > >
> > > 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
> > >
> >
> >
> >
> > 
> >
> > --
> > 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] Re: Help with binding (flex 3)

2008-08-25 Thread Josh McDonald
I see your problem I think. Are you setting component.datasource =
resultEvent.result through actionscript somewhere? That won't get updated
when you make another service call, because a new result object is created.
If you bind to service.lastResult (or something, I don't do it that way)
instead, it should work. Once you set something manually without using
bindings, you can't get updates if that whole object is replaced.

-Josh


On Tue, Aug 26, 2008 at 1:14 AM, rss181919 <[EMAIL PROTECTED]> wrote:

> I get the same result.  As long as I copy the event.result properties
> over to my custom property, I get binding, but trying to set it to
> the object causes binding to fail even though the object properties
> transfer over to the custom property successfully.
>
> I set my webservice to makeObjectsBindable but this does not seem to
> help.  I also declare my storage object as bindable.  I read the
> recommendation about the IEventDispather but if the object and the
> properties have already been tagged as bindable and setting the
> properties directly causes binding, i dont think implementing
> IEventDispatcher will be a difference.
>
> Any other thoughts on this?  I could write a script to copy the
> properties over but i believe flex should do this and i would rather
> let flex handle it if it can.
>
>
> --- In flexcoders@yahoogroups.com, Nik Derewianka <[EMAIL PROTECTED]> wrote:
> >
> > 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
> >
>
>
>
> 
>
> --
> 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]


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

2008-08-25 Thread rss181919
I get the same result.  As long as I copy the event.result properties 
over to my custom property, I get binding, but trying to set it to 
the object causes binding to fail even though the object properties 
transfer over to the custom property successfully.

I set my webservice to makeObjectsBindable but this does not seem to 
help.  I also declare my storage object as bindable.  I read the 
recommendation about the IEventDispather but if the object and the 
properties have already been tagged as bindable and setting the 
properties directly causes binding, i dont think implementing 
IEventDispatcher will be a difference.  

Any other thoughts on this?  I could write a script to copy the 
properties over but i believe flex should do this and i would rather 
let flex handle it if it can.  


--- In flexcoders@yahoogroups.com, Nik Derewianka <[EMAIL PROTECTED]> wrote:
>
> 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
>