0
votes

A Flex components values are initialized by init method. In an application flow, How to refresh a mxml component data value ; as init is called at the start up itself only.

Example of mxml component may be as simple as button label or text as complex as repeater whose data provider is a web service ( means a fresh quesy should be made to pull the data and refresh the dataprovider of repeater )

4
Please give an example of the type of data you want to refresh.cliff.meyers

4 Answers

0
votes

If the dataprovider is a collection or an array it will update itself as items are added to or deleted from the collection. You can listen to the CollectionEvent.CollectionChange event to see when a collection changes.

I'm not really sure what you mean though? Are you on about binding?

0
votes

If you want to re-init the whole control, you could create an "reset" event and have the handler for the reset execute the same behavior as the init code.

That's the best I can do without more details...

0
votes

you should create yourself setters and getters for the properties you want to modify and a refresh is required afterwards. for example:

private var _tmp : String = '';
public function set tmp(val : String) : void {
      this._tmp = val;
      this.doOtherDataRefreshNeeded();
}
public function get tmp() : String {
      return this._tmp;
}

and this way, everytime the code that uses this component and needs to update it's tmp property. the setter will be called and in there a lot of other stuff can happen beside assigning the value.

for simple mxml components as texts and inputs, use bindings {} for their data values. those should update as soon as the data changes. if not, call .invalidateNow() method on them to force update.

0
votes

use ValidateNow() method in mxml component in updating method