View unanswered posts | View active topics It is currently Sun Dec 29, 2024 6:10 am



Reply to topic  [ 1 post ] 
 Problem with a bit of script 
Author Message

Joined: Fri Mar 16, 2007 1:28 pm
Posts: 328
Location: Finland
Reply with quote
Post Problem with a bit of script
So. For some reason the onServerResponse function doesn't run.
Any help appreciated. All the hello traces work by the way.
Code:
trace ("hello")
var service:URLLoader = new URLLoader();
trace ("hello2")
var url:URLRequest = new URLRequest('http://ajax.googleapis.com/ajax/services/search/web');
trace ("hello3")
var urlvars:URLVariables = new URLVariables();
trace ("hello4")
var jsfeed:Object = new Object();
trace ("hello5")
urlvars.v = '1.0';
trace ("hello")
urlvars.q = 'testsearch';
url.data = urlvars;
trace ("hello")
service.addEventListener(Event.COMPLETE, onServerResponse);
service.load(url);
trace ("hello")
function onServerResponse(event:Event):void {
  try {
    var jsfeed:Object = JSON.decode(URLLoader(event.target).data as String);
    var results:Array = json.responseData.results;
    for (var i:int = 0; i < results.length; i++){
       trace(json.responseData.results[i].titleNoFormatting+" "+results[i].url);
   }
  }catch(ignored:Error) {
  }
}
trace ("hello")


Thu Sep 04, 2008 7:36 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

Users browsing this forum: Google [Bot]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.023s | 14 Queries | GZIP : Off ]