MACROMEDIA FLASH 8-EXTENDING FLASH Bedienungsanleitung Seite 13

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 17
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 12
2003 Macromedia, Inc. 13
Linking a Combo Box to a List Box
In this section you will link the Combo Box to a List Box, so that only the
products for the selected category display in the List Box. This is where
you will learn to handle the “change event” on the Combo Box.
Steps
1. Return to RemoteCatalog.fla in the war directory.
Adding a Flash MX Component to the Stage
2. Expand the Components panel. Click Window Æ Components if not
open already.
3. Select Flash UI Components.
4. Drag an instance of the ListBox component just below the Products
per Category text on the stage.
5. Use the Free-Transform tool or the Properties panel to resize it.
6. In the Properties pane, give the ListBox an instance name of
products_lb.
Handling a Change Event in Flash MX
7. Open the Actions panel for frame 1 of the Actions layer (press F9).
8. At the bottom of the code, specify the name of the change handler
function for the category_cb ComboBox. Give it the name
productsByCategory, as follows:
category_cb.setChangeHandler("productsByCategory");
9. In the functions section, create the event handler function that will be
invoked when a category is selected, as follows:
Declare a function named productsByCategory
function productsByCategory() {}
In the body of the function, declare a variable category and assign
to it the value selected from the ComboBox. The getValue()
method returns the data associated with the selected label:
var category = category_cb.getValue();
Invoke the getProductsByCategory(int catId) method of the
RemoteCatalog class, passing category as the parameter. Use the
catalogService object you already created:
catalogService.getProductsByCategory(Number(catego
ry));
Seitenansicht 12
1 2 ... 8 9 10 11 12 13 14 15 16 17

Kommentare zu diesen Handbüchern

Keine Kommentare