Amazon is one of the most well-known Internet storefronts on the planet, and they have opened up their product database to the public for free. With the Amazon web service, you can search their database web for books, DVDs, and more, and have the results sent back to an application you design and build. The first thing you will have to do is get your key from Amazon by signing up at http://www.amazon.com/gp/browse.html/103-7710202-8564650?%5Fencoding=UTF8&node=3435361 The key lets Amazon know who is using the search engine. When you have gotten your personal key, you will need to download the sample file for this application from the accompanying website. The application itself has everything but the key. The purpose of this application is to see the power of web services. This example allows you to search Amazon's DVD collection at will, and it returns 10 results each time. When one of those results is selected, it displays an image of that DVD. When you have downloaded the sample application from the website and have gotten your key from amazon.com, open the file amazonFinal.fla and follow these steps to make it work:
Let's go over the code in the first frame of the Actions layer. The first section creates the object to listen to the search button. We then assign the event to it that, when triggered, activates the webServiceConnector component. Finally, we add the event listener to the Search button. //the listener object var amzObj:Object = new Object(); //the event amzObj.click=function(){ myConnector.trigger(); } //add the event listener to the button search_butn.addEventListener("click",amzObj); This application is not using all the results that are returned. Use the Web Services panel to see what else is available (http://soap.amazon.com/schemas2/AmazonwebServices.wsdl). You can also see all the different web methods we did not use, such as author search. The possibilities are endless, and this application is merely a good start. |