MACROMEDIA FLASH MX 2004-USING COMPONENTS Use Manual page 27

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

Advertisement

Next, the code populates the TextArea and Label instances by using the
and
priceQualifier
elements in the products.xml file that you linked to the products_xmlcon XMLConnector
instance at the beginning of the tutorial. Later in the tutorial, you'll bind the XMLConnector,
DataSet, and DataGrid component instances together, and the elements in the XML file will
populate the other two component instances.
Finally, the code uses the
product into the Loader component.
Next you'll add an event listener to add the product to the cart when the user clicks the Add to
3.
Cart button. (You'll add ActionScript to the main Timeline in the application later in the
tutorial, to create an instance of the Cart class.) Add the following code:
var cartListener:Object = new Object();
cartListener.click = function(evt:Object) {
var tempObj:Object = new Object();
tempObj.quantity = evt.target._parent.quantity_ns.value;
tempObj.id = thisProduct.id;
tempObj.productObj = thisProduct;
var theCart = evt.target._parent._parent._parent.myCart;
theCart.addProduct(tempObj.quantity, thisProduct);
};
addToCart_button.addEventListener("click", cartListener);
Click the Check Syntax button (the blue check mark above the Script pane) to make sure there
4.
are no syntax errors in the code.
You should check syntax frequently as you add code to an application. Any errors found in the
code are listed in the Output panel. (When you check syntax, only the current script is
checked; other scripts that may be in the FLA file are not checked.) For more information, see
"Debugging your scripts" in Using ActionScript in Flash.
Click the arrow button at the top left of the document window or select View > Edit Document
5.
to exit symbol editing mode and return to the main Timeline.
Add components for the Checkout screen
When the user clicks the Checkout button on the main screen, the Checkout screen appears. The
Checkout screen provides forms where the user can enter billing, shipping, and credit card
information.
The checkout interface consists of components placed on a keyframe at Frame 10 in the
application. You'll use the Accordion component to create the checkout interface. The Accordion
component is a navigator that contains a sequence of children that it displays one at a time. You'll
also add a Button component instance to create a Back button, so users can return to the main
screen.
properties of the
thisProduct
property of the
image
object. These properties correspond to
object to load an image of the
thisProduct
Build the application architecture
,
,
description
price
27

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004-USING COMPONENTS and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash mx

Table of Contents