简体   繁体   中英

Flex components property change event

I have a custom component on which I have bound an array collection to one of its proeprties:

<comp:MyComp id="comp" prop="{images}" />

images is an arraycollection

In the components' code I would like to know which event to listen on everytime images updates props.I tried a setter on props but the setter only gets called once when props is first set. I tried the collection event but I get "Update" events sent on top of 'add' and 'remove' events and I would rather not have to manage those. So is there an event(flex or otherwise) that is fired every time a component property is updated by a bindable property?

I think you want to listen to the collectionChange event on the prop property. This should fire every time an element in your ArrayCollection changes.

Be warned that changing the source of images not fire the collectionChange event, nor will it fire the prop setter.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM