Would you like to tell us how we are doing?

You bet No thanks

Creating a list dialog

How to

Create a list dialog box in your application.


Construct the list dialog box variable in the root of your class

var myList:ListDialog = new ListDialog();
// Placing this at the class root allows other 
//application elements to reference it.

Initialize the attributes of your dialog box

// Set title text.
myList.title = "Drink Options";
// Add buttons.

// OPTIONAL: enable multi-select.
myList.multiSelect = true;

// Create array of items for list.
myList.items = ['Milkshake', 'Cola', 'Lemonade', 'Water', 'Root Beer', 'Orange Juice', 'Apple Juice'];
// Add a listener for user clicking on a button.
myList.addEventListener(Event.SELECT, listButtonClicked);

Add the call to display your dialog box where desired

// In this sample it is fine to simply place this call 
// once right after setup to display one time on launch.

Create the function that is called by your dialog box's button selection event

private function listButtonClicked(event:Event):void{
	// Output index of clicked button.
	trace("Button Clicked Index: " + myList.selectedIndex);

	// If first button was selected.
	if (myList.selectedIndex == 1){
		// Output array of selected index values.
		trace("You chose option(s) " + myList.listSelectedIndices);

Build Requirements

You must include the following classes in your project:

import qnx.fuse.ui.dialog.ListDialog;
import flash.events.Event;


When you create a list dialog, you create your PopupListobject, initialize its properties to whatever values your application requires, and finally call the show() function when you want to display the dialog. The multiSelect property can also be set to true in order to allow the user to choose more than one option. To add functionality, add an Event.SELECT listener function to perform any actions that are defined in the function when one of the buttons is selected. You can also reference which of your dialog's buttons was chosen by the user anywhere in the class by using the selectedIndex property. The selectedIndices property will return an array of integers marking which options in the list the user selected, in the order of their selection.