Hi.

I'm having a little trouble getting the value of an attribute in an  XML 
string. I am trying to get the value of 'url' out of the following XML:

<media:thumbnail width="66" height="49" 
url="http://newsimg.bbc.co.uk/media/images/46491000/jpg/_46491622_mcarthur_pa.jpg
 
/>"

I am using a HTTPService request to get the feed as follows:

<s:HTTPService id="feedStream"
                            
url="http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/uk/rss.xml";
                            result="feedStream_resultHandler(event)" />   


I am then querying the returned XML as follows:

protected function feedStream_resultHandler(e:ResultEvent):void
{
            var myX:String = 
e.result.rss.channel.item[0].media_thumbna...@url;
            trace(myX);
           
            //dpac = e.result.feed.entry as ArrayCollection;
            dpac = e.result.rss.channel.item as ArrayCollection;

           trace(dpac[0].title); // returns the title
}

I get the following error:

TypeError: Error #1010: A term is undefined and has no properties.
    at 
Flex4CustomComponent/feedStream_resultHandler()[/Users/barrygee/Documents/Adobe 
Flash Builder Beta/Flex4CustomComponent/src/Flex4CustomComponent.mxml:38]
    at 
Flex4CustomComponent/__feedStream_result()[/Users/barrygee/Documents/Adobe 
Flash Builder Beta/Flex4CustomComponent/src/Flex4CustomComponent.mxml:12]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at 
mx.rpc::AbstractOperation/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()[E:\dev\beta1\frameworks\projects\rpc\src\mx\rpc\AbstractOperation.as:249]
    at 
mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()[E:\dev\beta1\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:318]
    at 
mx.rpc::Responder/result()[E:\dev\beta1\frameworks\projects\rpc\src\mx\rpc\Responder.as:58]
    at 
mx.rpc::AsyncRequest/acknowledge()[E:\dev\beta1\frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:84]
    at 
DirectHTTPMessageResponder/completeHandler()[E:\dev\beta1\frameworks\projects\rpc\src\mx\messaging\channels\DirectHTTPChannel.as:446]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at flash.net::URLLoader/onComplete()

It looks like the attribute is'nt being found even though it does exist.

All suggestions very welcome.

Thanks

Barry.

Reply via email to