Lesson 24. Using Shared Objects


What You Will Learn

In this lesson, you will:

  • Create a new shared object on the client machine

  • Write a complex data structure to the shared object

  • Read data from an existing shared object

  • Use data from an existing shared object to populate form controls

Approximate Time

This lesson takes approximately 45 minutes to complete.

Lesson Files

Media Files:

None

Starting Files:

Lesson24/start/views/ecomm/Cart.mxml

Lesson24/start/views/ecomm/Checkout.mxml

Lesson24/start/valueObjects/ShoppingCart.as

Completed Files:

Lesson24/complete/views/ecomm/Cart.mxml

Lesson24/complete/views/ecomm/Checkout.mxml

Lesson24/complete/valueObjects/ShoppingCart.as

An important part of most applications is the capability to persist data, such as remembering information about a specific user. Persisting user data can be done at the server by associating a user with a login ID and then passing specific information back to a server. The information is then written to a database and can be loaded back into the application when needed.

Using Adobe Flex, it is also possible to persist data on the client side, actually within Flash Player using the SharedObject class. Shared objects are similar to HTTP cookies, but are much more powerful because you can store complex data structures within them. In this lesson, you will use the SharedObject class to store information about which grocery items a user is interested in purchasing.

The Save For Later button writes items in the shopping cart into a shared object on the local machine for later retrieval.




Adobe Flex 2.Training from the Source
Adobe Flex 2: Training from the Source
ISBN: 032142316X
EAN: 2147483647
Year: 2006
Pages: 225

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net