|
submitRating Method
Description
This method assigns the submitted rating value to the specified video.
Arguments
This method accepts the following arguments:
|
id
|
Integer. Required.
The unique id value for an available video in the search engine.
|
|
rating
|
Number between 0 and 5. Required.
The numerical rating that will be assigned to the video. This is a number between 0 and 5 that, when submitted, will be averaged with the other user ratings assigned to this video to determine an aggregate rating.
|
Syntax
The following code sample illustrates how this method can be invoked:
var TVS = new TruveoVideoSearch(appid);
...
TVS.submitRating(id, rating);
Return Value
This method returns 'true' if the XML API request was sent successfully. This method will return 'false' if it is called with the incorrect number of arguments.
Response Data Objects
The response returned by this method can update the following data objects:
|
method
|
A string containing the name of the API method used to retrieve the response. In this case, this field would return the string 'submitRating'.
Usage syntax: myVar = TVS.method;
|
|
Result
|
The container for the response code, response message and any other information returned in this response.
More details on the structure and attributes of this data object can be found here.
Usage syntax: myVar = TVS.Result;
|
Events
This method can fire the following events:
|
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.
Event binding syntax: TVS.addEventListener('onupdate', myHandler);
|
|
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.
Event binding syntax: TVS.addEventListener('onerror', myHandler);
|
Errors
If execution of this method is not successful, the errors with the following error codes can be thrown:
|
400
|
Bad API request or API Service unavailable. Check that the parameters to the request are correctly specified.
A method of the Flash API was called with incorrect arguments or the XML API service is unavailable.
|
|
502
|
Invalid Flash method call: The wrong number of arguments was provided to this method.
A method of the Flash API was called with too many or too few arguments. (Note: only applies to AS2.0 version of API.)
|
|