Main Page | Packages | Class Tree | Index | Help

com.bjc.controls

class Accordion

MovieClip
  |
  +--com.bjc.core.BJCComponent
        |
        +--com.bjc.core.LabelWrapper
              |
              +--com.bjc.controls.Accordion


class Accordion
extends LabelWrapper

A multi-sectioned accordion component. A movie clip can be attached inside each section.

Events:

change - Fired whenever the active section of the accordion is changed by the user clicking on one of the headers.
focus - Fired whenever the component receives focus.
killFocus - Fired whenever the component loses focus.
tabFocus - Fired whenever the component receives focus by pressing the TAB key.


Author:
Flashloaded - www.flashloaded.com


Field Summary

public
addEventListener: Function
See the EventDispatcher Class in Flash Help

public
changeHandler: Function
Can be used to assign a direct event handler to the component instance.

public
focusHandler: Function
Can be used to assign a direct event handler to the component instance.

public
killFocusHandler: Function
Can be used to assign a direct event handler to the component instance.

public
removeEventListener: Function
See the EventDispatcher Class in Flash Help

public
tabFocusHandler: Function
Can be used to assign a direct event handler to the component instance.

Fields inherited from class com.bjc.core.BJCComponent

version

Property Summary

public
autoSizeContents: Boolean (write)
Sets the autoSizeContent mode. If true, each content clip will be sized to the available space. Content clip must support a setSize(w ,h) method.

public
autoSizeContents: Boolean (read)
Gets the autoSizeContent mode.

public
content: Array (read-only)
An array containing references to the attached movie clip in each section.

public
selectedIndex: Number (write)
Selects the specified section

public
selectedIndex: Number (read)
Returns the number of the currently selected section

Properties inherited from class com.bjc.core.LabelWrapper

align, disabledColor, disableStyles, embedFont, fontColor, fontFace, fontSize, html

Properties inherited from class com.bjc.core.BJCComponent

disabledAlpha, enabled, focusTime, height, keyEnabled, style, width

Constructor

public
Accordion ( Void)


Method Summary

public
addSection ( title: String, contentPath: String, icon: String ): Void
Adds a new section to the accordion

public
addSectionAt ( title: String, contentPath: String, icon: String, index: Number ): Void
Adds a new section to the accordion at the specified position

public static
create ( target: MovieClip, id: String, depth: Number, initObj: Object ): Accordion
Static method used to create an instance of an Accordion on stage at run time.

public
removeAll ( Void ): Void
Removes all sections from the accordion

public
removeSectionAt ( index: Number ): Void
Removes the section at the specified index

Methods inherited from class com.bjc.core.BJCComponent

draw, invalidate, move, remove, setSize



Field Documentation

addEventListener

public var addEventListener: Function
See the EventDispatcher Class in Flash Help

changeHandler

public var changeHandler: Function
Can be used to assign a direct event handler to the component instance.

Usage:
myAccord.changeHandler = function(){
trace("section changed.");
}

focusHandler

public var focusHandler: Function
Can be used to assign a direct event handler to the component instance.

Usage:
myAccord.focusHandler = function(){
trace("Set focus.");
}

killFocusHandler

public var killFocusHandler: Function
Can be used to assign a direct event handler to the component instance.

Usage:
myAccord.killFocusHandler = function(){
trace("Kill focus.");
}

removeEventListener

public var removeEventListener: Function
See the EventDispatcher Class in Flash Help

tabFocusHandler

public var tabFocusHandler: Function
Can be used to assign a direct event handler to the component instance.

Usage:
myAccord.tabFocusHandler = function(){
trace("Tab focus.");
}


Property Documentation

autoSizeContents

public autoSizeContents: Boolean (write)
Sets the autoSizeContent mode. If true, each content clip will be sized to the available space. Content clip must support a setSize(w ,h) method.

Example:
myAccord.autoSizeContents = true;

autoSizeContents

public autoSizeContents: Boolean (read)
Gets the autoSizeContent mode.

Example:
myVar = myAccord.autoSizeContents;

content

public content: Array (read-only)
An array containing references to the attached movie clip in each section.

Example:
myAccord.content[0].addEventListener("click", this);
// this assumes that the content in section zero is a component which broadcasts a click event

selectedIndex

public selectedIndex: Number (write)
Selects the specified section

Example:
myAccord.selectedIndex = 2;

selectedIndex

public selectedIndex: Number (read)
Returns the number of the currently selected section

Example:
myVar = myAccord.selectedIndex;


Constructor Documentation

Accordion

public function Accordion(Void)

Method Documentation

addSection

public function addSection(title: String,
 contentPath: String,
 icon: String): Void
Adds a new section to the accordion

Usage:
accordion.addSection(title:String, contentPath:String, icon:String):Void

Parameters:
title
a string that will be displayed in the section header
contentPath
the linkage name of a movie clip in the library to attach in this section, or the url of an external swf or jpg to load in.
icon
the linkage name of a movie clip in the library to set as header icon.
Returns:
nothing

Example:
myAccord.addSection("Section One", "firstSectionMC", "");

addSectionAt

public function addSectionAt(title: String,
 contentPath: String,
 icon: String,
 index: Number): Void
Adds a new section to the accordion at the specified position

Parameters:
title
a string that will be displayed in the section header
contentPath
the linkage name of a movie clip in the library to attach in this section, or the url of an external swf or jpg to load in.
icon
the linkage name of a movie clip in the library to set as header icon.
index
Returns:
nothing

Example:
myAccord.addSectionAt("Section One", "firstSectionMC", "myIcon", 3);

create

public static function create(target: MovieClip,
 id: String,
 depth: Number,
 initObj: Object): Accordion
Static method used to create an instance of an Accordion on stage at run time.

Parameters:
target
the movie clip to which the accordion will be attached.
id
the instance name given to the new accordion attached.
depth
the depth at which to attach the new accordion.
initObj
(optional) an object containing any properties you want to assign to the component when it is created
Returns:
a reference to the new accordion attached.

Example:
import com.bjc.controls.Accordion;
var newAccord:Accordion = Accordion.create(_root, "myAccord", 0);

removeAll

public function removeAll(Void): Void
Removes all sections from the accordion

Returns:
nothing

Example:
myAccord.removeAll();

removeSectionAt

public function removeSectionAt(index: Number): Void
Removes the section at the specified index

Parameters:
index
the number of the section (zero-indexed) to remove
Returns:
nothing

Example:
myAccord.removeSection(4);


The documentation was generated from the following file:


Copyright Flashloaded - www.flashloaded.com