if (xfa.host.name == "Flash") { // ActionScript in Guide (Flex) space // The XML object is a "Top Level" object in Flex which means we don't need to import its class. // When we come back from fliping to the PDF, the list will still have items in it however we want to // re-execute the query on categories so clear the list and set it to read-only again. this.clearItems(); this.access = "readOnly"; // send the request to the Movie service FlexHttpService.send ( // url to get a list of categories "http://forms.stefcameron.com/services/movies/?movie=0&category=0", // result handler function(catListXml:XML):void { trace("=== SUCCESS retrieving category list:\n" + catListXml.toXMLString()); // get the CategoryList field var catList = xfa.form.movieList.GuideObjects.CategoryList; // add a new item for each category in the list returned for each (var catXml in catListXml.elements()) catList.addItem(catXml.catName, catXml.catId); // enable the list for selection now that we've added items catList.access = "open"; }, // fault handler function(fault:String):void { import mx.controls.Alert; trace("=== ERROR retrieving category list:\n" + fault); Alert.show("Error retrieving list of categories: " + fault); } ); }