Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You said:</p> <blockquote> <p>On creation complete my parent component executes an "init" function which simply sets public bindable variables in child components. I'd like the child components to watch these variables and upon being set use them.</p> </blockquote> <p>It breaks encapsulation to try to have the child component access the parent. Parents can access, children, but children should never access parents. However, any given component should be aware of when it's values changes and update itself accordingly. The use of get/set properties and the Flex Component LifeCycle are the proper way to do that. </p> <p>When you make a component Bindable that means it can be used as the source of data binding. It almost sounds to me like you're trying to use said properties as the target for data binding and are struggling to update your component. </p> <p>If I understand what you're after, I wouldn't use the ChangeWatcher at all. Just expand your user property into a get/set property and either implement your changes in the set method of the property, or possibly in commitProperties using a flag. </p> <p>Something like this:</p> <pre><code>private var _user : Object; [Bindable] public function get user():Object{ return this._user; } public function set user(value:Object):void{ this._user = value; Alert.show(value); } </code></pre> <p>Or even better:</p> <pre><code>protected var userChanged : Boolean = false; private var _user : Object; [Bindable] public function get user():Object{ return this._user; } public function set user(value:Object):void{ this._user = value; this.inalidateProperties() userChanged = true; } public function commitProperties():void{ if(userChanged == true){ Alert.show(value); userChanged = false; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload