One-way communication
One-way communication in Flash is the process of sending data to a Web server and not looking or caring if a response comes back. This is mostly used to open a URL, but could also be used to update a file with no intention of handling the result. This type of communication is often used for simply firing off an event or running some sort of cleaning system. For example, if your site needs periodic file cleaning deleting, renaming, moving , it is a good idea to attach this to the front-end...
loginHandler method
The loginHandler method is attached to the CLICK event of the loginBtn. This method is called whenever the loginBtn is clicked by the mouse. private function loginHandler e MouseEvent void This method is responsible for checking the username and password fields for valid data. If one of these fields is empty, the function is exited and a response message is displayed below the password field. loginMC.responseTxt.text if loginMC.username.text loginMC.password.text loginMC.responseTxt.text...
Using the Amazon Web Service
To get started with creating a developers account, visit the Amazon Web Service AWS page at www.amazon.com gp aws landing.html. j j' J'j Be sure to activate the account via e-mail before you begin to use it. The AWS is set up to be accessed from different mediums. The format used for this example is Representational State Transfer REST , which is basically a formatted URL with all of the necessary information provided in GET format. Here is a sample request sent to Amazon, as shown in Figure...
myPlayer.stop();
For simplicity, the video player component has the ability to be skinned, which means you don't have to design a custom interface. This custom skin loads in a default set of playback controls. In fact, Adobe offers a large list of skins, each in different colors or with various selections of buttons and functionality For example, here is the most common example used. This skin is a full set of controls that is placed underneath the video player component. Seeing as this skin has basic playback...
AMFPHP services
The AMFPHP services needed for this example are responsible for querying the database based on passed-in arguments. This also requires a database connection system that will need to be secure. This means methods will not be exportable or viewable by AMFPHP. For simplicity, all of this functionality is contained in one service. However, in a more complete application, you would want to separate the classes into different services for a more portable solution. Figure 9.7 shows the completed...
Timeline code
var phpFile String var cart MovieClip shoppingCart cart.setGatewayURL phpFile var storeItems MovieClip new MovieClip storeItems.x 25 storeItems.y 80 var urlRequest URLRequest new URLRequest phpFile action getproducts var urlLoader URLLoader new URLLoader productsLoaded urlLoader.load urlRequest function productsLoaded e Event void var urlLoader URLLoader URLLoader e.target var xml XML new XML urlLoader.data for each var xmlItem in xml..product var item StoreItem new StoreItem item.y 85 id...
Testing AMFPHP with a custom service
With AMFPHP properly installed, you can test a very simple service using the service browser. Later, you build a small search application in Flash and PHP. An AMFPHP service is a standard PHP file that is built in a known order. For example, the first part of a service file is the method table, which is used to expose the available methods and define the access restrictions of that service. A method table is a multidimensional array containing each of the methods. This sample method table...