Accordion.destroyChildAt()

Availability

Flash Player 6 (6.0.79.0).

Edition

Flash MX Professional 2004.

Usage

accordionInstance.destroyChildAt(index)

Parameters

index The index number of the accordion child to destroy. Each child of an accordion is assigned a zero-based index number in the order in which it was created.

Returns

Nothing.

Description

Method (inherited from View); destroys one of the accordion's children. The child to be destroyed is specified by its index, which is passed to the method in the index parameter. Calling this method destroys the corresponding header as well.

If the destroyed child is selected, a new selected child is chosen. If there is a next child, it is selected. If there is no next child, the previous child is selected. If there is no previous child, the selection is undefined.

NOTE

 

Calling destroyChildAt() decreases the numChildren property by 1.

Example

The following code destroys the first child of my_acc when the third child is selected:

import mx.core.View;

// Create child panels with instances of the View class.
my_acc.createSegment(View, "myMainItem1", "Menu Item 1");
my_acc.createSegment(View, "myMainItem2", "Menu Item 2");
my_acc.createSegment(View, "myMainItem3", "Menu Item 3");

// Create new Listener object.
my_accListener = new Object();
my_accListener.change = function() {
   if ("myMainItem3"){
   my_acc.destroyChildAt(0);
   }
};

my_acc.addEventListener("change", my_accListener);

See also

Accordion.createChild()


Flash CS3