spring
spring

Reputation: 18517

Flash Builder break on warning (of a binding error)?

I've injected some silly binding error in a large legacy project and am having trouble finding it.
This is the error output to the console:

warning: unable to bind to property 'length' on class 'String' (class is not an IEventDispatcher)

I've tried stepping through with the debugger try to track down where this is happening but there are many thousands of lines of code and with event messaging, a very non-linear program execution.

Question: Is there any way to make Flash Builder break on a warning like this? If not, is there some other method, trick or hack for tracking this down?

Upvotes: 2

Views: 138

Answers (1)

Bill Turner
Bill Turner

Reputation: 1010

This is caused by (wait for it...) trying to bind to a property that isn't marked as [Bindable]. In this case, you have a string variable whose length property is being used for data binding.

This is most likely caused by adding "myvar.length" as a property in the MXML tag for a component -- something like

<s:TextInput maxChars="{myInputString.length}" ...>

Flex will create the data binding for you automatically, but it doesn't realize at runtime that the property isn't Bindable - meaning, if there are changes to the property value the notification won't propagate to update the listeners.

Data binding uses mx.binding.PropertyWatcher to do the binding, and PropertyWatcher.updateParent is where the warning is output.

Upvotes: 2

Related Questions