2003 Macromedia, Inc. 14
Test the invocation using the NetConnection Debugger. Notice
that an array of 3 products gets returned for the “snow” category.
Populating the Component with Dynamic Data
10. In the functions section, create a responder function that will receive
the returned data from the getProductsByCategory() call, and populate
the product_lb ListBox. This responder is similar to the one already
coded:
Copy the getCategories_result() method.
Rename the function as getProductsByCategory_result().
Inside the function, add a new line of code to remove any existing
items in the ListBox by calling the removeAll().
Again we’re going to use DataGlue to bind our data to our
ListBox.
DataGlue.bindFormatStrings (product_lb, result,
"#name#");
Here is the completed code for your reference:
//event handler to capture returned product list
function getProductsByCategory_result(result) {
product_lb.removeAll();
DataGlue.bindFormatStrings (product_lb,
result, "#name#");
}
11. Test the movie (Cntl + Enter). You should see related products for
every selected category.
12. Open a browser and test the generated .swf using a URL that points to
your new Flash widget. For example:
http://localhost/flashremoting/samples/flashwidgets/R
emoteCatalog.swf
13. Publish an html document that embeds the .swf file you just created.
Click File Æ Publish Settings. Make sure Flash and HTML are
selected. Click the Publish button to generate .swf and .html versions
of the Flash document.
14. Open RemoteCatalog.html in a text editor. Notice the basic html file
generated. Change the title and add any html content before or after
the <object> tag.
15. Browse the new version of RemoteCatalog.html.
Komentarze do niniejszej Instrukcji