The MochiBot Feedback System is a comment and rating feature that Flash developers can quickly and simply add to their Flash movies. The purpose of the MochiBot Feedback System is to provide Flash developers better feedback on their work. Usage stats provide an objective view of a SWF's popularity, but user comments and ratings provide a more intimate understanding of how your audience feels your efforts.
The sections below will cover all areas of the MochiBot Feedback System. The first section will present some pre-developed interfaces that can be downloaded and used in your own Flash movies. The sections that follow will cover the API of the MochiBot Feedback System and how you can create your own interface to capture feedback from you audience.
If at any point you need help with the topics discussed here then try using to MochiBot Forum to look for answers and ask questions. The forum will also be used to showcase the custom feedback interfaces that other developers build for their Flash movies.
The MochiBot Feedback System API allows developers to create a customized feedback capturing interface and combine that with MochiBot's pre-built feedback database and presentation layer for their own Flash movies. The sections below will detail how to send and retrieve data from the MochiBot Feedback System.
Some basic feedback information for your SWF is returned every time a request is made to the API.
API URL:Arguments:
These values should be submitted via the GET method (i.e, through the querystring).Return Values:
Example Code:
MOCHIBOT_ID = "XXXXXXXX";
MOCHIBOT_FEEDBACK_API_PATH = "http://www.mochibot.com /api/api-feedback.html?mochibot_id=" + MOCHIBOT_ID;
MochiBotGetFeedback = function() {
oReceive = new LoadVars();
oReceive.onLoad = function(success) {
if (success) {
trace("Results loaded:");
trace("score = " + this.score);
trace("votes = " + this.votes);
trace("comments = " + this.comments);
trace("commentsPublic = " + this.commentsPublic);
} else {
trace("An error occurred");
}
}
oReceive.load(MOCHIBOT_FEEDBACK_API_PATH);
}
Example Results
&score=1.09&votes=45&comments=72&commentsPublic=1&rank=&category=
Send in votes with this method.
API URL:Arguments:
These values should be submitted via the POST method.Return Values:
Example Code:
MOCHIBOT_ID = "XXXXXXXX";
MOCHIBOT_FEEDBACK_API_PATH = "http://www.mochibot.com /api/api-feedback.html";
MochiBotSubmitVote = function(vVote) {
oSend = new LoadVars();
oReceive = new LoadVars();
oSend.mochibot_id = MOCHIBOT_ID;
oSend.vote = vVote;
oReceive.onLoad = function(success) {
if (success) {
trace("Results loaded:");
trace("score = " + this.score);
trace("votes = " + this.votes);
trace("comments = " + this.comments);
trace("commentsPublic = " + this.commentsPublic);
} else {
trace("An error occurred");
}
}
oSend.sendAndLoad(MOCHIBOT_FEEDBACK_API_PATH, oReceive, 'POST');
}
Example Results
&score=1.09&votes=45&comments=72&commentsPublic=1&rank=&category=
Usage Tips
Send in comments with this method.
API URL:Arguments:
These values should be submitted via the POST method.Return Values:
Example Code:
MOCHIBOT_ID = "XXXXXXXX";
MOCHIBOT_FEEDBACK_API_PATH = "http://www.mochibot.com /api/api-feedback.html";
MochiBotSubmitComment = function(vName, vEmail, vComment) {
oSend = new LoadVars();
oReceive = new LoadVars();
oSend.mochibot_id = MOCHIBOT_ID;
oSend.name = vName;
oSend.email = vEmail;
oSend.comment = vComment;
oReceive.onLoad = function(success) {
if (success) {
trace("Results loaded:");
trace("score = " + this.score);
trace("votes = " + this.votes);
trace("comments = " + this.comments);
trace("commentsPublic = " + this.commentsPublic);
} else {
trace("An error occurred");
}
}
oSend.sendAndLoad(MOCHIBOT_FEEDBACK_API_PATH, oReceive, 'POST');
}
Example Results
&score=1.09&votes=45&comments=72&commentsPublic=1&rank=&category=
The following three functions will help to limit the number of times a person can vote or submit a comment. This helps prevent abuse and flooding your score.
Parameters:
These are variables that can be passed into the functions.Usage Code:
// Sets a Flash cookie to prevent people from voting multiple timees
function setVoteLimiter(vCookieName){
cookie = SharedObject.getLocal(vCookieName);
var my_date:Date = new Date();
var year = my_date.getFullYear();
var month = my_date.getMonth();
var date2 = my_date.getDate();
var hour = my_date.getHours();
var min = my_date.getMinutes();
var sec = my_date.getSeconds();
cookie.data.year = year;
cookie.data.month = month;
cookie.data.date = date2;
cookie.data.hour= hour;
cookie.data.min = min;
cookie.data.sec = sec;
cookie.flush();
}
// Checks to see when the vote limiting Flash cookie was last set
function checkVoteLimiter(vCookieName, vVotingLimit){
cookie = SharedObject.getLocal(vCookieName);
var cookie_year = cookie.data.year;
var cookie_month = cookie.data.month;
var cookie_date = cookie.data.date;
var cookie_hour = cookie.data.hour;
var cookie_min = cookie.data.min;
var cookie_sec = cookie.data.sec;
cookieDate = new Date(cookie_year, cookie_month, cookie_date, cookie_hour, cookie_min, cookie_sec);
cookieMillisecs = cookieDate.getTime();
currentDate = new Date();
currentMillisecs = currentDate.getTime();
var msecs = currentMillisecs - cookieMillisecs;
var secs = Math.floor(msecs/1000);
var mins = Math.floor(secs/60);
var hours = Math.floor(mins/60);
if (mins < vVotingLimit && cookie_year != undefined){
// You can't vote yet
return false;
} else {
// You can vote now
return true;
}
}
// clears the vote limiting Flash cookie
function clearCookie(vCookieName) {
cookie = SharedObject.getLocal(vCookieName);
cookie.clear();
}