Plus, beware of this line:

modules = e.result as XMLListCollection

 

It will succeed, but will give you a single item in the
XMLListCollection.  If that is what you want, ok, but usually you would
specify an expression that returns some child nodes.

 

trace(modules.toXMLString()); //to be sure you have what you expect.

 

Tracy

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Scott - FastLane
Sent: Monday, September 10, 2007 5:22 PM
To: [email protected]
Subject: Re: [flexcoders] Getting xml in code only

 

Steve - 

I believe you intend to be adding the listener for the Event.RESULT
event instead of the Event.COMPLETE.

hth
Scott

Steve Hueners wrote: 

        All the samples i've come across so far show the mxml route -
I'm able
        to instantiating and fireing the send correctly with:
        
        public var myRequest:HTTPService = new HTTPService;
        public var modules:XMLListCollection;
        
        public function MenuItemEnum ( value:String, ordinal:int )
        {
        myRequest.url = "/xml/modules.xml";
        myRequest.resultFormat="e4x"
        
        myRequest.addEventListener(Event.COMPLETE, onResult)
        myRequest.send(); //>>>>>> Is hit.
        }
        
        private function onResult(e:ResultEvent):void
        {
        modules = e.result as XMLListCollection;
        
        }
        
        private function onFault(e:FaultEvent):void
        {
        Alert.show(e.fault.message, "Could not load");
        }
        
        But the handlers never fire.

 

 

Reply via email to