Home | Contact Us | Store

Flash List Component ActionScript 3 Tutorial

This Flash Component tutorial series show how to use List with Flash ActionScript 3.

Flash ActionScript component control tutorial example display here. Your flash player version is too old to see this Flash tutorial example!

Flash Tutorial Content:

The Flash List component displays list-based information and is ideally suited for the display of arrays of information.

The finished Flash Movie of this tutorial is shown as above. Click on the above Flash Movie and play around.

Flash ActionScript Codes:

//Uncomment the following line if create runtime List Box
//import fl.controls.List;
import fl.events.ListEvent

//Add Items to List
fruitList.addItem( {label: "Apple"} );
fruitList.addItem( {label: "Orange"} );
fruitList.addItem( {label: "Papaya"} );
fruitList.addItem( {label: "Banana"} );
fruitList.addItem( {label: "Water Melon"} );

//Add ITEM_ROLL_OVER event listener to List
//Whenever the mouse Roll Over a Label, function showItemLabel will be called
fruitList.addEventListener(ListEvent.ITEM_ROLL_OVER, showItemLabel);

 

function showItemLabel(event:ListEvent):void {

//Display message on "Label of List" TextField
fruitListLabel_txt.text = "Do you like " + event.item.label + " ?";

//Empty message on "Message Box" TextField
output_txt.text = "";

}

 

//Add ITEM_ROLL_OVER event listener to List
//Whenever a Label is selected, function selectItemLabel will be called
fruitList.addEventListener(ListEvent.ITEM_CLICK, selectItemLabel);

 

function selectItemLabel(event:ListEvent):void {

//Display message on "Label of List" TextField
fruitListLabel_txt.text = "You selected " + event.item.label;

if (event.item.label == "Orange") {
//Display message on "Message Box" TextField
output_txt.text = "Yeah.... " + event.item.label + " is my favorite fruit!";
}

}

Download Flash Source File:

Flash Source File list.fla

Remarks:

This Flash ActionScript tutorial shows how to use Flash List component.

ActionScript Component Control Tutorial