[flexcoders] Re: unable to bind to property on class....

2007-04-10 Thread JWOpitz
Have you looked into using the metatags on the setter/getter?  Making
the class itself bindable?  I wrote a post about this a while back,
maybe you can get some info off of it:

http://jwopitz.wordpress.com/2007/03/29/a-common-binding-issue-and-a-work-around/

--- In flexcoders@yahoogroups.com, "scott_flex" <[EMAIL PROTECTED]> wrote:
>
> 
> Thanks, that did it, I initialized the value of userDisplayName via 
> my setter (which I didn't have before), instead of just through the 
> private _userDisplayName variable, bindings worked!
> 
> I still get this message though:
> warning: unable to bind to property 'current' on class 'com::session' 
> (class is not an IEventDispatcher), and my session class does extend 
> the EventDispatcher class...
> 
> I don't like it, but everything now works as expected... that is good.
> 
> Thanks for your help, it's always something simple i'm missing... 
> this group has been a ton of help!!
> 
> -Scott
> 
> 
> --- In flexcoders@yahoogroups.com, "Paul DeCoursey"  wrote:
> >
> > do you have a setter on the property?  I don't see one in the code 
> you
> > posted.  You need a setter for it to bind. Or at least you must 
> fire a
> > PropertyChangeEvent when the property changes.
> > 
> > Paul
> > 
> > 
> > --- In flexcoders@yahoogroups.com, "scott_flex"  wrote:
> > >
> > > 
> > > Actully, and i should have noted that in first post, i did try 
> that, 
> > > but same warnings and same effect, no errors, but my property did 
> not 
> > > bind to my label's text.
> > > 
> > > Would it or could it have anything to do with the fact it's a 
> > > singleton object??... I wouldn't think so.
> > > 
> > > Not shown in the example, but i also exposed some public 
> > > ArrayCollectin lists of value objects and was able to bind 
> > > successfully to those, just not my public string properties.  So 
> why 
> > > somethings bind ok, and others don't?
> > > 
> > > thanks for your response.
> > > 
> > > --Scott
> > > 
> > > 
> > > --- In flexcoders@yahoogroups.com, "Paul DeCoursey"  wrote:
> > > >
> > > > Binding depends on the object being able to dispatch events to 
> > > notify
> > > > the bind target that the property changed. To get around this 
> you
> > > > simply extend EventDispatcher.
> > > > 
> > > > ie.
> > > > public class session extends EventDispatcher {
> > > > 
> > > > that will fix the warnings and bind your properties.
> > > > 
> > > > Paul
> > > > 
> > > > 
> > > > --- In flexcoders@yahoogroups.com, "scott_flex"  
> wrote:
> > > > >
> > > > > 
> > > > > I'm not the first person to run into this and after searching 
> > > some 
> > > > > previous threads i don't see any good explanations.  Any help 
> is 
> > > > > appreciated.
> > > > > 
> > > > > When i build my app, i get these warning messages and not 
> sure 
> > > how to 
> > > > > fix them.  I don't get any errors when i bind a label's text 
> > > property 
> > > > > like this {com.session.current.userDisplayName}, it just 
> doesn't 
> > > bind 
> > > > > when I run the code.
> > > > > 
> > > > > warning: unable to bind to property 'current' on 
> > > class 'com::session' 
> > > > > (class is not an IEventDispatcher)
> > > > > warning: unable to bind to property 'userDisplayName' on 
> > > > > class 'com::session'
> > > > > 
> > > > > Here's a code snippet of my session class, which is a 
> singleton 
> > > class.
> > > > >  
> > > > > package com
> > > > > {
> > > > >   [Bindable]
> > > > >   public class session
> > > > >   {
> > > > >   
> > > > >   // -
> > > > >   // SINGLETON STUFF
> > > > >   // -
> > > > >   private static var _current:com.session = null;
> > > > >   public static function get current():com.session
> > > > >   {
> > > > >   if (_current == null) _current = new 
> com.session();
> > > > >   return _current;
> > > > >   }   
> > > > > 
> > > > >   // -
> > > > >   // CONSTRUCTOR
> > > > >   // -
> > > > >   public function session()
> > > > >   {
> > > > >   if (_current != null)
> > > > >   {
> > > > >   throw new Error("Only one instance of 
> the 
> > > > > session should be instantiated");
> > > > >   }
> > > > >   }
> > > > >   
> > > > >   private var _userDisplayName:String 
>   = "User's 
> > > > > Fullname Goes here";
> > > > >   public function get userDisplayName():String {return 
> > > > > _userDisplayName;}
> > > > >   
> > > > >   }
> > > > > }
> > > > >
> > > >
> > >
> >
>




[flexcoders] Re: unable to bind to property on class....

2007-04-10 Thread scott_flex

Thanks, that did it, I initialized the value of userDisplayName via 
my setter (which I didn't have before), instead of just through the 
private _userDisplayName variable, bindings worked!

I still get this message though:
warning: unable to bind to property 'current' on class 'com::session' 
(class is not an IEventDispatcher), and my session class does extend 
the EventDispatcher class...

I don't like it, but everything now works as expected... that is good.

Thanks for your help, it's always something simple i'm missing... 
this group has been a ton of help!!

-Scott


--- In flexcoders@yahoogroups.com, "Paul DeCoursey" <[EMAIL PROTECTED]> wrote:
>
> do you have a setter on the property?  I don't see one in the code 
you
> posted.  You need a setter for it to bind. Or at least you must 
fire a
> PropertyChangeEvent when the property changes.
> 
> Paul
> 
> 
> --- In flexcoders@yahoogroups.com, "scott_flex"  wrote:
> >
> > 
> > Actully, and i should have noted that in first post, i did try 
that, 
> > but same warnings and same effect, no errors, but my property did 
not 
> > bind to my label's text.
> > 
> > Would it or could it have anything to do with the fact it's a 
> > singleton object??... I wouldn't think so.
> > 
> > Not shown in the example, but i also exposed some public 
> > ArrayCollectin lists of value objects and was able to bind 
> > successfully to those, just not my public string properties.  So 
why 
> > somethings bind ok, and others don't?
> > 
> > thanks for your response.
> > 
> > --Scott
> > 
> > 
> > --- In flexcoders@yahoogroups.com, "Paul DeCoursey"  wrote:
> > >
> > > Binding depends on the object being able to dispatch events to 
> > notify
> > > the bind target that the property changed. To get around this 
you
> > > simply extend EventDispatcher.
> > > 
> > > ie.
> > > public class session extends EventDispatcher {
> > > 
> > > that will fix the warnings and bind your properties.
> > > 
> > > Paul
> > > 
> > > 
> > > --- In flexcoders@yahoogroups.com, "scott_flex"  
wrote:
> > > >
> > > > 
> > > > I'm not the first person to run into this and after searching 
> > some 
> > > > previous threads i don't see any good explanations.  Any help 
is 
> > > > appreciated.
> > > > 
> > > > When i build my app, i get these warning messages and not 
sure 
> > how to 
> > > > fix them.  I don't get any errors when i bind a label's text 
> > property 
> > > > like this {com.session.current.userDisplayName}, it just 
doesn't 
> > bind 
> > > > when I run the code.
> > > > 
> > > > warning: unable to bind to property 'current' on 
> > class 'com::session' 
> > > > (class is not an IEventDispatcher)
> > > > warning: unable to bind to property 'userDisplayName' on 
> > > > class 'com::session'
> > > > 
> > > > Here's a code snippet of my session class, which is a 
singleton 
> > class.
> > > >  
> > > > package com
> > > > {
> > > >   [Bindable]
> > > >   public class session
> > > >   {
> > > > 
> > > > // -
> > > > // SINGLETON STUFF
> > > > // -
> > > > private static var _current:com.session = null;
> > > > public static function get current():com.session
> > > > {
> > > > if (_current == null) _current = new 
com.session();
> > > > return _current;
> > > > }   
> > > > 
> > > > // -
> > > > // CONSTRUCTOR
> > > > // -
> > > > public function session()
> > > > {
> > > > if (_current != null)
> > > > {
> > > > throw new Error("Only one instance of 
the 
> > > > session should be instantiated");
> > > > }
> > > > }
> > > > 
> > > > private var _userDisplayName:String 
= "User's 
> > > > Fullname Goes here";
> > > > public function get userDisplayName():String {return 
> > > > _userDisplayName;}
> > > > 
> > > > }
> > > > }
> > > >
> > >
> >
>




[flexcoders] Re: unable to bind to property on class....

2007-04-10 Thread Paul DeCoursey
do you have a setter on the property?  I don't see one in the code you
posted.  You need a setter for it to bind. Or at least you must fire a
PropertyChangeEvent when the property changes.

Paul


--- In flexcoders@yahoogroups.com, "scott_flex" <[EMAIL PROTECTED]> wrote:
>
> 
> Actully, and i should have noted that in first post, i did try that, 
> but same warnings and same effect, no errors, but my property did not 
> bind to my label's text.
> 
> Would it or could it have anything to do with the fact it's a 
> singleton object??... I wouldn't think so.
> 
> Not shown in the example, but i also exposed some public 
> ArrayCollectin lists of value objects and was able to bind 
> successfully to those, just not my public string properties.  So why 
> somethings bind ok, and others don't?
> 
> thanks for your response.
> 
> --Scott
> 
> 
> --- In flexcoders@yahoogroups.com, "Paul DeCoursey"  wrote:
> >
> > Binding depends on the object being able to dispatch events to 
> notify
> > the bind target that the property changed. To get around this you
> > simply extend EventDispatcher.
> > 
> > ie.
> > public class session extends EventDispatcher {
> > 
> > that will fix the warnings and bind your properties.
> > 
> > Paul
> > 
> > 
> > --- In flexcoders@yahoogroups.com, "scott_flex"  wrote:
> > >
> > > 
> > > I'm not the first person to run into this and after searching 
> some 
> > > previous threads i don't see any good explanations.  Any help is 
> > > appreciated.
> > > 
> > > When i build my app, i get these warning messages and not sure 
> how to 
> > > fix them.  I don't get any errors when i bind a label's text 
> property 
> > > like this {com.session.current.userDisplayName}, it just doesn't 
> bind 
> > > when I run the code.
> > > 
> > > warning: unable to bind to property 'current' on 
> class 'com::session' 
> > > (class is not an IEventDispatcher)
> > > warning: unable to bind to property 'userDisplayName' on 
> > > class 'com::session'
> > > 
> > > Here's a code snippet of my session class, which is a singleton 
> class.
> > >  
> > > package com
> > > {
> > >   [Bindable]
> > >   public class session
> > >   {
> > >   
> > >   // -
> > >   // SINGLETON STUFF
> > >   // -
> > >   private static var _current:com.session = null;
> > >   public static function get current():com.session
> > >   {
> > >   if (_current == null) _current = new com.session();
> > >   return _current;
> > >   }   
> > > 
> > >   // -
> > >   // CONSTRUCTOR
> > >   // -
> > >   public function session()
> > >   {
> > >   if (_current != null)
> > >   {
> > >   throw new Error("Only one instance of the 
> > > session should be instantiated");
> > >   }
> > >   }
> > >   
> > >   private var _userDisplayName:String = "User's 
> > > Fullname Goes here";
> > >   public function get userDisplayName():String {return 
> > > _userDisplayName;}
> > >   
> > >   }
> > > }
> > >
> >
>




[flexcoders] Re: unable to bind to property on class....

2007-04-10 Thread scott_flex

Actully, and i should have noted that in first post, i did try that, 
but same warnings and same effect, no errors, but my property did not 
bind to my label's text.

Would it or could it have anything to do with the fact it's a 
singleton object??... I wouldn't think so.

Not shown in the example, but i also exposed some public 
ArrayCollectin lists of value objects and was able to bind 
successfully to those, just not my public string properties.  So why 
somethings bind ok, and others don't?

thanks for your response.

--Scott


--- In flexcoders@yahoogroups.com, "Paul DeCoursey" <[EMAIL PROTECTED]> wrote:
>
> Binding depends on the object being able to dispatch events to 
notify
> the bind target that the property changed. To get around this you
> simply extend EventDispatcher.
> 
> ie.
> public class session extends EventDispatcher {
> 
> that will fix the warnings and bind your properties.
> 
> Paul
> 
> 
> --- In flexcoders@yahoogroups.com, "scott_flex"  wrote:
> >
> > 
> > I'm not the first person to run into this and after searching 
some 
> > previous threads i don't see any good explanations.  Any help is 
> > appreciated.
> > 
> > When i build my app, i get these warning messages and not sure 
how to 
> > fix them.  I don't get any errors when i bind a label's text 
property 
> > like this {com.session.current.userDisplayName}, it just doesn't 
bind 
> > when I run the code.
> > 
> > warning: unable to bind to property 'current' on 
class 'com::session' 
> > (class is not an IEventDispatcher)
> > warning: unable to bind to property 'userDisplayName' on 
> > class 'com::session'
> > 
> > Here's a code snippet of my session class, which is a singleton 
class.
> >  
> > package com
> > {
> >   [Bindable]
> >   public class session
> >   {
> > 
> > // -
> > // SINGLETON STUFF
> > // -
> > private static var _current:com.session = null;
> > public static function get current():com.session
> > {
> > if (_current == null) _current = new com.session();
> > return _current;
> > }   
> > 
> > // -
> > // CONSTRUCTOR
> > // -
> > public function session()
> > {
> > if (_current != null)
> > {
> > throw new Error("Only one instance of the 
> > session should be instantiated");
> > }
> > }
> > 
> > private var _userDisplayName:String = "User's 
> > Fullname Goes here";
> > public function get userDisplayName():String {return 
> > _userDisplayName;}
> > 
> > }
> > }
> >
>




[flexcoders] Re: unable to bind to property on class....

2007-04-10 Thread Paul DeCoursey
Binding depends on the object being able to dispatch events to notify
the bind target that the property changed. To get around this you
simply extend EventDispatcher.

ie.
public class session extends EventDispatcher {

that will fix the warnings and bind your properties.

Paul


--- In flexcoders@yahoogroups.com, "scott_flex" <[EMAIL PROTECTED]> wrote:
>
> 
> I'm not the first person to run into this and after searching some 
> previous threads i don't see any good explanations.  Any help is 
> appreciated.
> 
> When i build my app, i get these warning messages and not sure how to 
> fix them.  I don't get any errors when i bind a label's text property 
> like this {com.session.current.userDisplayName}, it just doesn't bind 
> when I run the code.
> 
> warning: unable to bind to property 'current' on class 'com::session' 
> (class is not an IEventDispatcher)
> warning: unable to bind to property 'userDisplayName' on 
> class 'com::session'
> 
> Here's a code snippet of my session class, which is a singleton class.
>  
> package com
> {
>   [Bindable]
>   public class session
>   {
>   
>   // -
>   // SINGLETON STUFF
>   // -
>   private static var _current:com.session = null;
>   public static function get current():com.session
>   {
>   if (_current == null) _current = new com.session();
>   return _current;
>   }   
> 
>   // -
>   // CONSTRUCTOR
>   // -
>   public function session()
>   {
>   if (_current != null)
>   {
>   throw new Error("Only one instance of the 
> session should be instantiated");
>   }
>   }
>   
>   private var _userDisplayName:String = "User's 
> Fullname Goes here";
>   public function get userDisplayName():String {return 
> _userDisplayName;}
>   
>   }
> }
>