I made a very simple component to replace any component (e.g. a comboBox) on a form that is hidden if a user does not have access to change the value:
<?xml version="1.0" encoding="utf-8"?>
<mx:Label xmlns:mx="http://www.adobe.com/2006/mxml"
visible="{!_controlToReplace.visible}"
includeInLayout="{!_controlToReplace.includeInLayout}">
<mx:Script>
<![CDATA[
import mx.core.UIComponent;
[Bindable]
private var _controlToReplace:UIComponent;
public function set controlToReplace(value:UIComponent):void
{
_controlToReplace=value;
}
]]>
</mx:Script>
</mx:Label>
The same functionality of the component can be easily done by having a label on the form instead:
<mx:Label text="{objControl.text}"
visible="{!objControl.visible}"
includeInLayout="{!objControl.includeInLayout}"/>
With the component I can do this, which I like better:
<Components:ReadOnlyPlaceHolder controlToReplace="{objControl}"/>
But regardless of whether or not objControl is visible, it doesn't get displayed. Do you have any idea what I could be missing?