Hi,
I've got a Flex 3 question about using includeInLayout with a component instance.
So, to access the instance of my component, I used something like this:
var _myCard:Card = this["card"+cardNum];
I wanted to "turn-off" the datagrid in the component, so I used bindings on "includeInLayout" and "visible":
if(myArray.length == 0){
_myCard.myBoolean = false;
_myCardInstance.myBoolean = false;
}
This worked fine. The dataGrid wasn't visible. But, I was wondering why, I couldn't access the includeInLayout and visible properties directly. Why couldn't I do:
_myCard.myGrid.visible = false;
_myCard.myGrid.includeInLayout = false;
Is there a way to do it without bindings? Bindings are fine. I just didn't understand why the above didn't work. I'm trying to learn.
My shortened component is below:
<?xml version="1.0" encoding="utf-8"?>
<mx:Panel
xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
width="500"
height="400">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Bindable]
public var myBoolean: Boolean = true;
]]>
</mx:Script>
<mx:Text text="My Text" textAlign="center"/>
<mx:DataGrid id="myGrid"
y="200"
dataProvider="{myInitGrid}"
includeInLayout="{myBoolean}"
visible="{myBoolean}">
<mx:columns>
<mx:DataGridColumn dataField="TopicA" headerText="Topic A" width="130" textAlign="center" />
<mx:DataGridColumn dataField="TopicB" headerText="Topic B" width="130" textAlign="center" />
</mx:columns>
</mx:DataGrid>
</mx:Panel>
Thank you!
-Laxmidi