Flash Script - Listbox Component

How can you use the listbox component? Here’s a quick tour!

1. Open the components panel — hit ctrl+f7.

2. Drag the Listbox component onto the stage, and select the Listbox component in Frame 1. The component’s parameters are displayed in the Property inspector.

3. Name the component. Type "listbox" in the Property inspector Instance Name text box.

4. The Labels parameter displays a list of values users can select. Click the Labels field, then click the magnifying glass to open the Values pop-up window. Click the Plus (+) button to enter a new value.

Flash Script - Listbox Component

5. Click in the default value field, then type "one" for the first value. Click the Plus (+) button to enter the next value. Click in the default value field and type "two" for the next value.

Repeat this process to add the values for "three", "four", "five", and "six". When you’re finished, click Ok to close the label box.

6. The Data parameter is optional. It’s used to specify the values associated with the items (or labels) in the list box. There is no need to associate values with our labels in this case, so we won’t bother with this parameter.

7. The Select Multiple parameter specifies multiple selection. Set this to true, top allow users to select more than one option fromt eh list at a time.

8. Name the Click Handler. Type "f1" for the Click Handler name.

Flash Script - Listbox Component

9. Now, create two dynamic text fields as shown above. Give the first text field a variable name of "txt1", and call the second "txt2".

10. Select the first key frame from the existing layer, and press f9 to open the actions box. Insert the following code:

function f1()  {  //to get the item label  txt1.text = listbox.getSelectedItem().label;  //to get the multiple item values  txt2.text = listbox.getSelectedIndices();  }

Finished! Test the movie.

Replay

Category: software Time: 2003-07-24 Views: 0
Tags:

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

processed in 0.180 (s). 12 q(s)