Read Full Documentation >>
New Store with MX 2004 Pro and amfphp (based on version 1)
By: Jorge Solis

This is a new Flash MX 2004 Pro version of the online store. There are two fla files in the zip: flashdb_newstore.fla that use AS1 remoting classes (NetConnection and NetDebugger) and flashdb_newstore2.fla that use AS2 remoting classes (Service, pendingCall, relayResponder, Log, etc) So based on your Flash Remoting version, chose one or the other (most of you with the latest version will use flashdb_newstore2.fla)
In order to use this example you need:
- A local web server with PHP support
- A My SQL database
- Remoting Flash classes
- The amphp Remoting library
... and Flash MX 2004 Pro, of course
My first intention was to write a correct AS2 code, but my attempt was failed for some of this reasons:
- The app use Remoting, and wrapping result handlers inside classes is really
a mess
- Scope using AS2 classes is also a headache in relationship to movie clips
on stage and also other classes
- Components (datagrid, accordion, scrollPane, alert) are really a great help
in faster building this app, so this helps my lazy side in not to follow a more
strict discipline in coding
- At last but not at least, not much time and not much knowledge about AS2
So those who expect an example in AS2 classes working with remoting, don't loss your time. I have used a collection of functions to manage this stuff. Probably the most interesting part is the easy integration of the new components into a "one screen" app. Now the scrollPane can manage scripting and loadMovie, fixing the scroll as needed (in the wish list of the MX scrollPane) without much problem. Also I love the accordion, where you can open and close screens as needed, saving a lot of space in your stage. The datagrid is the base of the shopping cart, some of the heavy work in the previous version, where I should draw completely the table trough the drawing API. So somethings that you can find:
- Loading and attaching dinamic content to a ScrollPane
- Managing Accordion to diplay/close different nodes
- Managing datagrid to build a simple Shopping Cart
The database is the same as the previous version, and the Remoting methods are just slightly different. Some of the most difficult things was building a preload. AS2 components have a serious problem in this: if you build an external preload, you need to instantiate manually all the components or move and instance of the component to the main library, making the external preload fail again. Additionally you need to export your classes not in the first frame, breaking my "one frame" spirit. So I have used a different approach: a second movie on the same HTML with a "preloader" message. Since the main movie have just 100 kb, the preload movie just blink until all the content is loaded. Trough a LocalConnection object I have connect both movies, so when the main movie is ready, it fires an event that make the preloader disappear.
Ok, enough explanation. For those interesting in more details, continue reading.
Quick setup:
Install first the amfphp library from http://www,amfphp.org/
and check Hello World Remoting
for further details about Remoting
Then
1. Unzip all the files to some folder under your root web folders
2. Open inc_sql.php and change Database, Host, Username and Password to match
your needs
3. Run setup.php to create Database and tables (or use shopping.sql trough phpMyAdmin)
4. Open gateway.php and modify the path to the flashservices/app/Gateway.php
from the amfphp packet
5. Open flashdb_newstore.fla and change "pathToRemoting" variable in the first
frame of the code layer (line 2) to match your path
6. With your web server and database running, publish the movie

5 most recent
Tree menu
Flash Spell Checker
Flash Remoting Library
MX 2004 Chart/Poll
Applications
Download
the Source Files