Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
Adobe Flex SDK 4.0 (Release)
-
None
-
Affected OS(s): All OS Platforms
Affected OS(s): All OS Platforms
Language Found: English
Description
Steps to reproduce:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:ui="ui.*"
xmlns:components="lib.components.*" >
<fx:Declarations>
<fx:XML id="testData" xmlns="">
<nodes>
<node text="stuff" />
</nodes>
</fx:XML>
</fx:Declarations>
<s:layout>
<s:VerticalLayout id="myLayout" />
</s:layout>
<fx:Script>
<![CDATA[
import mx.core.UIComponent;
[Bindable]
public function set data(content:String):void
public function get data():String
{ return this.testData.toXMLString(); } [Bindable]
public function set selected(val:Boolean):void
public function get selected():Boolean
{ return (this.testData.node['@sel'] == '1'); } [Bindable]
public function set text(newText:String):void
public function get text():String
{ return testData.node.@text; } ]]
>
</fx:Script>
<s:TextInput id="a" text="@
" width="100%" />
<s:CheckBox id="c" selected="@
" visible="
{testData.node.hasOwnProperty('@sel')}" />
<s:TextArea id="b" text="@
" width="100%" />
</s:Application>
Actual Results:
changing the value of text area a or checkbox c causes setters text or selected respectively to be called. These target text area b with execute bindings which works.
However, setter 'selected' when called, using this.executeBindings doesn't have the effect of updating a and b like it should.
Expected Results:
changing the contents of the xml displayed in TextArea b should, when executeBindings is called in the 'selected' setter update a and b', when working properly adding a sel='1' to the node element within the text field should make a checkbox visible and selected.
Workaround (if any):
After an experiment where I output this.numChildren and it displayed 1 (rather than 3). I realized there was also numElements. Outputting numElements I got the 3 I expected. So the following for loop does what I expected executeBindings(true) to do:
Rather than this.executeBindings(true) I replace it with the following in public function set data:
for( var i:int = 0; i< this.numElements; i++ ) {
UIComponent(this.getElementAt).executeBindings(true);
}
// Note: I'm using getElementAt
I believe the solution here is to update the core functionality of executeBindings so that it executes on child elements and not whatever numChildren is referring to, or maybe loop through both elements and children.
I'm marking it as a regression as there are reports from 2009 of executeBindings not working that were marked as resolved. However it is still an issue.