MACROMEDIA FLASH MX 2004-USING COMPONENTS Use Manual page 34

Using components
Hide thumbs Also See for FLASH MX 2004-USING COMPONENTS:
Table of Contents

Advertisement

UI Components Controls package
components, including ComboBox, DataGrid, Loader, TextInput, Label, NumericStepper,
Button, and CheckBox. A package is a directory that contains class files and resides in a
designated classpath directory. You can use a wild card to create references to all the classes in a
package: for example, the syntax
package. (When you create a reference to a package with a wild card, the unused classes are
dropped from the application when it is compiled, so they don't add any extra size.)
UI Components Containers package
container components, including Accordion, ScrollPane, and Window. As with the controls
package, you can create a reference to this package by using a wild card.
DataGridColumn class
their appearance.
Cart class
A custom class provided with this tutorial, the Cart class defines the functioning of
the shopping cart that you'll create later. (To examine the code in the Cart class file, open the
cart.as file located in the component_application folder with the application FLA and SWF files).
You'll create an Actions layer and add ActionScript code to the first frame of the main Timeline.
For all the code that you'll add to the application in the remaining steps of the tutorial, make sure
you place it on the Actions layer.
To import the WebServiceClasses item from the Classes library, select Window > Other
1.
Panels > Common Libraries > Classes.
Drag the WebServiceClasses item from the Classes library into the library for the application.
2.
Importing an item from the Classes library is similar to adding a component to the library: it
adds the SWC files for the class to the library. The SWC files need to be in the library in order
for you to use the class in an application.
In the Timeline, select the Form layer and click the Add New Layer button. Name the new layer
3.
Actions.
With the Actions layer selected, select Frame 1 and press F9 to open the Actions panel.
4.
In the Actions panel, enter the following code to create a
5.
application from looping during playback:
stop();
With Frame 1 in the Actions layer still selected, add the following code in the Actions panel to
6.
import the classes:
// import necessary classes
import mx.services.WebService;
import mx.controls.*;
import mx.containers.*;
import mx.controls.gridclasses.DataGridColumn;
// import the custom Cart class
import Cart;
34
Chapter 2: Creating an Application with Components (Flash Professional Only)
This package contains classes for the user interface control
mx.controls.*
This package contains classes for the user interface
This class lets you add columns to the DataGrid instance and control
creates references to all classes in the controls
function that prevents the
stop()

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flash mx

Table of Contents