User Guide
56 Accordion component (Flash Professional only)
Example
Start with an Accordion instance on the Stage named my_acc. Add a movie clip symbol to the
library with the Linkage Identifier
PaymentForm to be the Accordion child. Then, add a
symbol to the library with Linkage Identifier
payIcon to be the icon for the child header. The
following example creates an instance of the
PaymentForm movie clip symbol named billing
as the last child of
my_acc with header label “Payment” and the icon in the library:
var child_obj:Object = my_acc.createSegment("PaymentForm", "billing",
"Payment", "payIcon");
The following code creates a child that is an instance of the View class:
var child_obj:Object = my_acc.createSegment(mx.core.View, "billing",
"Payment", "payIcon");
The following code also creates a child that is an instance of the View class, but it uses import
to reference the constructor for the View class:
import mx.core.View;
var child_obj:Object = my_acc.createSegment(View, "billing", "Payment",
"payIcon");
Drag a Label component and a TextInput component from the Components panel to the
current document’s library (so that you have both a TextInput symbol and a Label symbol in
the library).The following code creates a child that is an instance of the View class named
billing, and also adds children to billing to provide labels and text input fields for a form:
import mx.core.View;
import mx.controls.Label;
import mx.controls.TextInput;
var child_obj:Object = my_acc.createSegment(View, "billing", "Payment",
"payIcon");
// Create labels as children of the view instance.
var cardType_label:Object = child_obj.createChild(Label, "CardType_label",
{_x:10, _y:50});
var cardNumber_label:Object = child_obj.createChild(Label,
"CardNumber_label", {_x:10, _y:100});
// Create text inputs as children of the view instance.
var cardTypeInput_ti:Object = child_obj.createChild(TextInput,
"CardType_ti", {_x:150, _y:50});
var cardNumberInput_ti:Object = child_obj.createChild(TextInput,
"CardNumber_ti", {_x:150, _y:100});
// Fill in labels.
cardType_label.text = "Card Type";
cardNumber_label.text = "Card Number";