| Package | yourminis.api.social |
| Class | public class SocialBase |
| Inheritance | SocialBase flash.events.EventDispatcher |
| Implements | ISocial |
| Subclasses | Bebo, Facebook, OpenSocial, SocialNone |
| Property | Defined by | ||
|---|---|---|---|
| ACTIVITY_CREATED : String [read-only] Event fired when an activity has been created
| SocialBase | ||
| AUTHENTICATION_COMPLETE : String [read-only] Event fired when authentication is completed
| SocialBase | ||
| delegate_friends : * | SocialBase | ||
| Friends : Array [read-only]
Get Friends - returns the yourminis version of friends, returning common data across opensocial and facebook
| SocialBase | ||
| SOCIAL_ONGETFRIENDS : String [read-only] Event fired when social friends have been retrieved
| SocialBase | ||
| ym_friends : * | SocialBase | ||
| ym_social_type : String | SocialBase | ||
| Method | Defined by | ||
|---|---|---|---|
|
SocialBase(_widget:Widget)
SocialBase serves as the delegate class for all Social Platforms, and stives to unify the various
social platforms under one API.
| SocialBase | ||
|
createActivity(title:String, body:String, summary:String = null, url:String = null, media:Array = null):void
| SocialBase | ||
|
getCurrentView():String
Returns the current view the widget is being displayed in, varies across platforms
| SocialBase | ||
|
getParameter(parameter_name:String):String
Returns the value of the specified parameter if it has been passed in by the social application, an empty string if not.
| SocialBase | ||
|
isBebo():Boolean
This function returns true if the widget is running on the Bebo platform, false otherwise
| SocialBase | ||
|
isFacebook():Boolean
This function returns true if the widget is running on the Facebook platform, false otherwise
| SocialBase | ||
|
isOpensocial():Boolean
This function returns true if the widget is running on the OpenSocial platform, false otherwise
| SocialBase | ||
|
isSocial():Boolean
This function returns true if the widget is running on a social platform, false otherwise
| SocialBase | ||
| ACTIVITY_CREATED | property |
ACTIVITY_CREATED:String [read-only]Event fired when an activity has been created
Implementation public function get ACTIVITY_CREATED():String
import yourminis.api.IWidget
var widget:IWidget;
addEventListener("widget-loaded",onWidgetLoaded);
function onWidgetLoaded(evt:Event):void {
widget.debugMode = true;
widget.initWidget(300,250,0x000000);
widget.social.addEventListener(widget.social.ACTIVITY_CREATED, onActivityCreated);
widget.social.createActivity("clicked a link", "The full URL is: http://www.yourminis.com");
}
function onActivityCreated(evt:Event):void {
widget.debug("activity created");
}
| api | property |
protected var api:IApiBase
| AUTHENTICATION_COMPLETE | property |
AUTHENTICATION_COMPLETE:String [read-only]Event fired when authentication is completed
Implementation public function get AUTHENTICATION_COMPLETE():String
import yourminis.api.IWidget
var widget:IWidget;
addEventListener("widget-loaded",onWidgetLoaded);//We must use a string literal instead of a constant because the event constants are not yet initialized in the widget class
function onWidgetLoaded(evt:Event):void {
widget.initWidget(300,250,0x000000);
widget.requireLibrary("facebook", ");
widget.addEventListener(widget.LIBRARIES_LOADED, onLibrariesLoaded);
}
function onLibrariesLoaded(evt:Event):void{
widget.initWidget();
widget.libraries.facebook.api_key = "5efb77b97275f66bde1ba5347f1116c2";
widget.libraries.facebook.secret = "ba566af38313fbb961034ab477b90c92";
widget.libraries.facebook.addEventListener(widget.social.AUTHENTICATION_COMPLETE, onAuthenticated);
widget.libraries.facebook.dispatchEvent(new Event(widget.social.NEED_AUTHENTICATION));
}
function onAuthenticated(evt:Event):void
{
widget.alert("authenticated!");
}
| delegate_friends | property |
public var delegate_friends:*
| Friends | property |
Friends:Array [read-only]Get Friends - returns the yourminis version of friends, returning common data across opensocial and facebook
Implementation public function get Friends():Array
See also
| SOCIAL_ONGETFRIENDS | property |
SOCIAL_ONGETFRIENDS:String [read-only]Event fired when social friends have been retrieved
Implementation public function get SOCIAL_ONGETFRIENDS():String
import yourminis.api.IWidget
var widget:IWidget;
addEventListener("widget-loaded",onWidgetLoaded);
function onWidgetLoaded(evt:Event):void {
widget.debugMode = true;
widget.initWidget(300,250,0x000000);
widget.social.addEventListener(widget.social.SOCIAL_ONGETFRIENDS, onGetFriends);
widget.social.getFriends();
}
function onGetFriends(evt:Event):void {
var friends:Array = widget.social.Friends;
for (var i=0; i < friends.length; i++)
{
var name = friends[i].name;
var gender = friends[i].gender;
var thumbnailurl = friends[i].thumbnailurl;
widget.debug("name: " + name + ", gender: " + gender + ", thumbnailurl: " + thumbnailurl);
}
}
| widget | property |
protected var widget:Widget
| ym_friends | property |
public var ym_friends:*
| ym_social_type | property |
public var ym_social_type:String
| SocialBase | () | constructor |
public function SocialBase(_widget:Widget)SocialBase serves as the delegate class for all Social Platforms, and stives to unify the various social platforms under one API.
Parameters_widget:Widget |
See also
//this is from our social rss sample available in yourminis developer downloads
import yourminis.api.IWidget
var rss;
var textfield:TextField;
var widget:IWidget;
addEventListener("widget-loaded",onWidgetLoaded);
function onWidgetResize( evt:Event ):void
{
textfield.width = widget.width -20;
textfield.height = widget.height -20;
}
function onDropDownLoaded( evt:Event):void
{
widget.chrome.addDropDownItem("yourminis","http://feeds.feedburner.com/yourminis",loadFeed);
widget.chrome.addDropDownItem("digg","http://digg.com/rss/index.xml",loadFeed);
widget.chrome.addDropDownItem("flickr","http://api.flickr.com/services/feeds/photos_public.gne?format=rss2",loadFeed);
}
function onWidgetLoaded(evt:Event)
{
//your widget has started and is ready for display
widget.initWidget(300,350,0xffffff);
widget.addEventListener(widget.WIDGET_RESIZED,onWidgetResize);
widget.addEventListener(widget.DROPDOWN_LOADED,onDropDownLoaded);
//add the textfield to the form
textfield = new TextField();
textfield.x = 5;
textfield.y = 5;
textfield.width = 280;
textfield.height = 330;
textfield.multiline = true;
textfield.wordWrap = true;
addChild(textfield);
rss = widget.newRSS();
rss.addEventListener(Event.COMPLETE,onRSSLoaded);
rss.load(new URLRequest(widget.getSetting("feedurl","http://feeds.feedburner.com/yourminis")));
addEventListener(TextEvent.LINK, linkHandler);
}
function loadFeed(feed)
{
widget.setSetting("feedurl",feed);
rss = widget.newRSS();
rss.addEventListener(Event.COMPLETE,onRSSLoaded);
rss.load(new URLRequest(feed));
}
function linkHandler(evt:TextEvent) {
//determine whether we are running in facebook then
//create a newsfeed item / opensocial activity
if (widget.social.isFacebook()) {
var fb:IFacebook = (widget.social as IFacebook);
var obj = new Object();
obj.link = evt.text; // this would replace a link variable in your template content
fb.publishUserAction(36440856409,obj,"","",1);
}
else {
widget.social.createActivity("clicked a link", "The full URL is: " + evt.text + "");
}
widget.reporting.trackURL(evt.text);
}
function onRSSLoaded(evt:Event)
{
var loader:URLLoader = URLLoader(evt.target);
var rssxml:XML = XML(loader.data);
var str = "";
for each (var item:XML in rssxml..item)
{
str+="" +
item.title + "
" +
item.description + "
";
}
textfield.htmlText = str;
}
| createActivity | () | method |
public function createActivity(title:String, body:String, summary:String = null, url:String = null, media:Array = null):voidParameters
title:String |
|
body:String |
|
summary:String (default = null) |
|
url:String (default = null) |
|
media:Array (default = null) |
| getCurrentView | () | method |
public function getCurrentView():StringReturns the current view the widget is being displayed in, varies across platforms
ReturnsString |
See also
import yourminis.api.IWidget
var widget:IWidget;
addEventListener("widget-loaded",onWidgetLoaded);
function onWidgetLoaded(evt:Event):void {
widget.initWidget(300,250,0x000000);
widget.debugMode = true;
widget.debug("Current View: " + widget.social.getCurrentView());
}
| getParameter | () | method |
public function getParameter(parameter_name:String):StringReturns the value of the specified parameter if it has been passed in by the social application, an empty string if not.
Parametersparameter_name:String — The name of the social parameter to get the value for (e.g. 'fb_sig_locale').
|
String |
| isBebo | () | method |
public function isBebo():BooleanThis function returns true if the widget is running on the Bebo platform, false otherwise
ReturnsBoolean |
import yourminis.api.IWidget
var widget:IWidget;
addEventListener("widget-loaded",onWidgetLoaded);
function onWidgetLoaded(evt:Event):void {
widget.initWidget(300,250,0x000000);
widget.debugMode = true;
widget.debug("Running on Bebo: " + widget.social.isBebo());
}
| isFacebook | () | method |
public function isFacebook():BooleanThis function returns true if the widget is running on the Facebook platform, false otherwise
ReturnsBoolean |
import yourminis.api.IWidget
var widget:IWidget;
addEventListener("widget-loaded",onWidgetLoaded);
function onWidgetLoaded(evt:Event):void {
widget.initWidget(300,250,0x000000);
widget.debugMode = true;
widget.debug("Running on Facebook: " + widget.social.isFacebook());
}
| isOpensocial | () | method |
public function isOpensocial():BooleanThis function returns true if the widget is running on the OpenSocial platform, false otherwise
ReturnsBoolean |
import yourminis.api.IWidget
var widget:IWidget;
addEventListener("widget-loaded",onWidgetLoaded);
function onWidgetLoaded(evt:Event):void {
widget.initWidget(300,250,0x000000);
widget.debugMode = true;
widget.debug("Running on OpenSocial: " + widget.social.isOpenSocial());
}
| isSocial | () | method |
public function isSocial():BooleanThis function returns true if the widget is running on a social platform, false otherwise
ReturnsBoolean |
import yourminis.api.IWidget
var widget:IWidget;
addEventListener("widget-loaded",onWidgetLoaded);
function onWidgetLoaded(evt:Event):void {
widget.initWidget(300,250,0x000000);
widget.debugMode = true;
widget.debug("Is running on a Social platform: " + widget.social.isSocial());
}