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 actors 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 actors "http://forms.stefcameron.com/services/movies/?movie=0&actor=0", // result handler function(actorListXml:XML):void { trace("=== SUCCESS retrieving actor list:\n" + actorListXml.toXMLString()); // get the ActorList field var actorList = xfa.form.movieList.GuideObjects.ActorList; // add a new item for each actor in the list returned for each (var actorXml in actorListXml.elements()) actorList.addItem(actorXml.actorName, actorXml.actorId); // enable the list for selection now that we've added items actorList.access = "open"; }, // fault handler function(fault:String):void { import mx.controls.Alert; trace("=== ERROR retrieving actor list: " + fault); Alert.show("Error retrieving list of actors: " + fault); } ); }