<?xml version="1.0" encoding="utf-8"?>
<mx:Application name="FormItem_includeInLayout_test"
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white"
initialize="init();">
<mx:Script>
<![CDATA[
import mx.binding.utils.BindingUtils;
import mx.containers.ApplicationControlBar;
import mx.containers.Form;
import mx.containers.FormItem;
import mx.containers.HBox;
import mx.controls.Button;
import mx.controls.ComboBox;
import mx.controls.TextArea;
import mx.controls.TextInput;
private var bccButton:Button;
private var bccFormItem:FormItem;
private var bccTextInput:TextInput;
private var bodyTextArea:TextArea;
private var ccFormItem:FormItem;
private var ccTextInput:TextInput;
private var fromButton:Button;
private var fromComboBox:ComboBox;
private var fromFormItem:FormItem;
private var sendButton:Button;
private var subjectFormItem:FormItem;
private var subjectTextInput:TextInput;
private var toFormItem:FormItem;
private var toTextInput:TextInput;
private function init():void {
bccButton = new Button();
bccButton.label = "Show BCC";
bccButton.toggle = true;
bccButton.selected = true;
bccButton.addEventListener(Event.CHANGE, bccButton_change);
fromButton = new Button();
fromButton.label = "Show From";
fromButton.toggle = true;
fromButton.selected = true;
fromButton.addEventListener(Event.CHANGE, fromButton_change);
var appControlBar:ApplicationControlBar;
appControlBar = new ApplicationControlBar();
appControlBar.dock = true;
appControlBar.addChild(bccButton);
appControlBar.addChild(fromButton);
addChildAt(appControlBar, 0);
sendButton = new Button();
sendButton.label = "Send";
sendButton.percentHeight = 100;
fromComboBox = new ComboBox();
fromComboBox.percentWidth = 100;
fromFormItem = new FormItem();
fromFormItem.label = "From:";
fromFormItem.includeInLayout = fromButton.selected;
fromFormItem.visible = fromButton.selected;
fromFormItem.percentWidth = 100;
fromFormItem.addChild(fromComboBox);
toTextInput = new TextInput();
toTextInput.percentWidth = 100;
toFormItem = new FormItem();
toFormItem.label = "To:";
toFormItem.percentWidth = 100;
toFormItem.addChild(toTextInput);
ccTextInput = new TextInput();
ccTextInput.percentWidth = 100;
ccFormItem = new FormItem();
ccFormItem.label = "CC:";
ccFormItem.percentWidth = 100;
ccFormItem.addChild(ccTextInput);
bccTextInput = new TextInput();
bccTextInput.percentWidth = 100;
bccFormItem = new FormItem();
bccFormItem.label = "BCC:";
bccFormItem.percentWidth = 100;
bccFormItem.addChild(bccTextInput);
subjectTextInput = new TextInput();
subjectTextInput.percentWidth = 100;
subjectFormItem = new FormItem();
subjectFormItem.label = "Subject:";
subjectFormItem.percentWidth = 100;
subjectFormItem.addChild(subjectTextInput);
var form:Form = new Form();
form.percentWidth = 100;
form.addChild(fromFormItem);
form.addChild(toFormItem);
form.addChild(ccFormItem);
form.addChild(bccFormItem);
form.addChild(subjectFormItem);
form.setStyle("indicatorGap", 0);
form.setStyle("paddingLeft", 0);
form.setStyle("paddingRight", 0);
form.setStyle("paddingTop", 0);
form.setStyle("paddingBottom", 0);
var hBox:HBox = new HBox();
hBox.percentWidth = 100;
hBox.addChild(sendButton);
hBox.addChild(form);
addChild(hBox);
bodyTextArea = new TextArea();
bodyTextArea.percentWidth = 100;
bodyTextArea.percentHeight = 100;
addChild(bodyTextArea);
}
private function bccButton_change(evt:Event):void {
bccFormItem.includeInLayout = bccButton.selected;
bccFormItem.visible = bccButton.selected;
}
private function fromButton_change(evt:Event):void {
fromFormItem.includeInLayout = fromButton.selected;
fromFormItem.visible = fromButton.selected;
}
]]>
</mx:Script>
</mx:Application>