Developer Center
Flash API Reference Documentation
The Truveo Video Search Flash API provides useful functionality for building a wide variety of video search and video browsing applications. As described in the overview of the Flash API, the ActionScript class 'TruveoVideoSearch' defines all of the attributes, methods, data objects, and events supported by the Flash API. This API interface is detailed below.
Version Compatibilitiy
The TruveoVideoSearch class is implemented in both ActionScript 3.0 (download here) and ActionScript 2.0 (download here). As a result, the API is compatible with versions 6 and above of Macromedia Flash. Note that when publishing your SWF in the Flash IDE, the ActionScript version in the Publish Settings dialog must match the version of the API you are using (i.e., either 'ActionScript 3.0' or 'ActionScript 2.0'). The following reference applies to both versions of the API, unless otherwise noted.
Attributes of the TruveoVideoSearch Object
The TruveoVideoSearch object supports several read/write attributes that can be used to configure the settings of the Flash API. Assuming that you have created an instance of the TruveoVideoSearch object named 'TVS', these attributes can be accessed as follows. To set the 'results' attribute, for example, to the value 20, the following ActionScript can be used:
TVS.results = 20;
Similarly, to display the value of this attribute to the Output window in the Flash IDE, the following ActionScript can be used:
trace(TVS.results);
A complete listing of the supported attributes of the TruveoVideoSearch object is provided in the table below.
appid
String value. Required.
The Application ID, which is a unique identifier, assigned by Truveo, for your application. To view your current Application ID or request a new one, please consult your My API Account page.
results
Integer between 1 and 50. Optional. Default value of 10.
The number of results the search engine should attempt to return in response to your request.
start
Integer not less than zero. Optional. Default value of 0.
The starting position of the first result, out of the entire set of matching results, that should be returned in response to your request.
showRelatedItems
Integer equal to 0 or 1. Optional. Default value of 0.
The flag which indicates if related tags, channels, categories and users should be included in the results returned in response to your request. A value of 1 indicates that these items should be included, and a value of 0 indicates that they should not.
tagResults
Integer between 1 and 50. Optional. Default value of 10.
The number of related tags the search engine should attempt to return in response to your request. This parameter is only relevant if 'showRelatedItems' is set to 1.
channelResults
Integer between 1 and 50. Optional. Default value of 10.
The number of related channels the search engine should attempt to return in response to your request. This parameter is only relevant if 'showRelatedItems' is set to 1.
categoryResults
Integer between 1 and 50. Optional. Default value of 10.
The number of related categories the search engine should attempt to return in response to your request. This parameter is only relevant if 'showRelatedItems' is set to 1.
userResults
Integer between 1 and 50. Optional. Default value of 10.
The number of related users the search engine should attempt to return in response to your request. This parameter is only relevant if 'showRelatedItems' is set to 1.
showAdult
Integer equal to 0 or 1. Optional. Default value of 0.
The flag which indicates if adult content should be included or excluded in the results returned in response to your request. A value of 1 indicates that adult content should be included, and a value of 0 indicates that adult content should be excluded.
Methods of the TruveoVideoSearch Object
The TruveoVideoSearch object exposes several methods that can be used to send requests to the Truveo video search service. The available methods are described in the table below.
getVideos This method can be used to submit a query to the Truveo video search service. This method returns the set of video results that match the submitted query.
getRelatedTags This method returns the set of tags that are associated with the videos that match the submitted query.
getRelatedChannels This method returns the set of channels that are associated with the videos that match the submitted query.
getRelatedCategories This method returns the set of categories that are associated with the videos that match the submitted query.
getRelatedUsers This method returns the set of users that are associated with the videos that match the submitted query.
submitRating This method assigns the submitted rating value to the specified video.
hasNextPage This method checks to see if an additional page of results is available for the current set of videos.
hasPreviousPage This method checks to see if a previous page of results is available for the current set of videos.
nextPage This method retrieves the next page of video search results for the current set of videos.
previousPage This method retrieves the previous page of video search results for the current set of videos.
goToPage This method retrieves the specified page of video search results for the current set of videos.
addEventListener This method attaches the specified listener to the specified event.
initialize This method initializes the state of the TruveoVideoSearch object.
Data Objects of the TruveoVideoSearch Object
The TruveoVideoSearch object can be used to send requests and receive responses containing data from the Truveo video search engine. Every time a response is received, the information contained in this response is stored in the TruveoVideoSearch object and made accessible through a set of objects that are of type XMLList. By accessing these XML objects, it is possible to retrieve video-related information to use in your application. For example, following a call to the Flash API getVideos method, the title of the first video in the response can be displayed in the Output window in the Flash IDE as follows:
trace(TVS.VideoSet.Video[0].title);
Note that the following line must be present before accessing any part of an XMLList object returned by the API:
default xml namespace = TVS.getDefaultNamespace();
The complete set of XML objects that is available through the TruveoVideoSearch object is shown in the table below.
VideoSet The container for all of the video records in the set of returned videos.
TagSet The container for all of the tags associated with the entire set of matching videos. The TagSet is returned only if the parameter 'showRelatedItems' is set to 1.
ChannelSet The container for all of the channels associated with the entire set of matching videos. The ChannelSet is returned only if the parameter 'showRelatedItems' is set to 1.
CategorySet The container for all of the categories associated with the entire set of matching videos. The CategorySet is returned only if the parameter 'showRelatedItems' is set to 1.
UserSet The container for all of the users associated with the entire set of matching videos. The UserSet is returned only if the parameter 'showRelatedItems' is set to 1.
Result The container for the response code, response message and any other information returned in this response.
Events of the TruveoVideoSearch Object
The TruveoVideoSearch object provides an asynchronous interface to the Truveo video search service. As a result, any calls to the methods of this object will be non-blocking. In other words, these method calls will return immediately, however the response to each request will be received at a later time. In order to handle responses received by the Flash API, the TruveoVideoSearch object exposes a set of events. These events can be used by your application to trigger specific actions that should be taken in response to information retrieved by the Flash API. The following code sample illustrates how an event handler function called 'myHandler' can be attached to the 'onupdate' event of the TruveoVideoSearch instance named 'TVS':
TVS.addEventListener("onupdate", myHandler);
The complete set of events that can be fired by the TruveoVideoSearch object is shown in the table below. Additional information about each event can be found in the reference documentation for the methods of the Flash API.
onload This event fires when the TruveoVideoSearch object initialization is complete. When this event fires, it will pass one argument, 'eventObj', of type com.truveo.flash.TruveoLoadEvent to any handler attached to this event. In addition to the standard properties associated with event objects in ActionScript, 'eventObj' will have a property 'reloadStateFlag' that will be set to true if the TruveoVideoSearch object was just initialized following a return from the AOL account login page.
onupdate This event fires when a response to an Flash request is received by the TruveoVideoSearch object. When this event fires, it will pass one argument, 'eventObj', of type com.truveo.flash.TruveoUpdateEvent to any handler attached to this event. In addition to the standard properties associated with event objects in ActionScript, 'eventObj' will have a property 'methodName' that will be set to the name of the method that issued the original Flash request associated with this onupdate event.
onerror This event fires when an error occurs. When this event fires, it will pass one argument, 'eventObj', of type com.truveo.flash.TruveoErrorEvent to any handler attached to this event. In addition to the standard properties associated with event objects in ActionScript, 'eventObj' will have two properties set: 'errorCode' and 'errorMessage'. The value of 'eventObj.errorCode' will be the numerical code assigned to the error and 'eventObj.errorMessage' will be a text message that describes the error.
Help Company Info Developer Resources Video Publisher Resources
Building Queries About Truveo Developer Center Truveo Director Accounts
Basic Searching Press Truveo API Overview Submitting A Feed Using Media RSS
Using Modifiers Team XML API Director Account FAQ
Using Filters Jobs AJAX API  
Using Sorters Contact Us Flash API  
Advanced Searching Terms of Use Ruby API  
  Privacy Policy Application Gallery  
  Adult FAQ    

Truveo video search lets you search and find videos from across the Web. Use Truveo to find all types of online video including hit television shows, full-length movies, breaking news clips, sports highlights, music videos, or the latest viral videos. If you are looking for a specific video, Truveo video search can help you find exactly the video you want. Truveo can also help you browse through video across the web and discover new videos that you might like.

©2004-2007 Truveo, Inc. All Rights Reserved.