Getting Twitter Search to work

4 views
Skip to first unread message

jitsion

unread,
Jul 26, 2009, 1:05:10 AM7/26/09
to SWX: The Native Data Format for Adobe Flash
Hi there,

I am new to AS3 and new to SWX as well.

I am trying to get the Search call function to work but keep getting
errors. any ideas ? I suspect its the result handler since the
external assets seems to be loaded.

pls help !


//********here's my call parameters for the search function in the API
calls. search term "mj"*******

var callParameters2:Object =
{
serviceClass: "Twitter",
method: "search",
args: ["mj","en", 1, , "NULL", "NULL", true],
resultHandler: resultHandler2
}

// ***********here's my result handler**********

function resultHandler2(event:Object)
{
trace (event.result[0].text+ " $$$$$ ");
}

//************error msg below********


ExternalAsset Progress(3448, 3448)
ExternalAsset HttpStatus: 200
ExternalAsset loaded
TypeError: Error #1010: A term is undefined and has no properties.
at twitter_fla::MainTimeline/resultHandler2()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at org.swxformat::ExternalAsset/onMovieReady()

Ben Lagoutte

unread,
Jul 26, 2009, 7:06:39 PM7/26/09
to swx-f...@googlegroups.com
Hi,

Yes, I think the problem is in your resultHandler

event.result represents whatever data the gateway returns. At times it
can be an array, at times i can be an object.

One way to find out is to test in the service explorer and see what
the function returns.

In the case of Twitter > Search it returns an object.

This object then contains a property called results. I believe this is
what you should be reading your data from...

function resultHandler2(event:Object)
{
var results = event.result.results;
}

You might also want to check whether the results array is empty before
trying to access [0]

hope this helps
Ben

jitsion

unread,
Jul 27, 2009, 5:40:50 AM7/27/09
to SWX: The Native Data Format for Adobe Flash
hey Ben

i got it !

thanks for your help. I tried your solution initially and I still got
the same ERROR

went to try out the "Service Explorer" and in the end I figured that
the search term that I was using "mj" returned nothing !! thts why it
was empty.

tks again
Reply all
Reply to author
Forward
0 new messages