Packageyourminis.api.social
Classpublic class SimpleSocial
InheritanceSimpleSocial Inheritance flash.events.EventDispatcher
ImplementsISocial

Main Social API Delegate The SimpleSocial class is responsible for the delegating basic Social APIs to services supporting OpenSocial and Facebook.

See also

yourminis.api.social.OpenSocial
yourminis.api.social.Facebook
yourminis.api.social.ISocial


Public Properties
 PropertyDefined by
  ACTIVITY_CREATED : String
[read-only] Event fired when an activity has been created
SimpleSocial
  AUTHENTICATION_COMPLETE : String
[read-only] Event fired when authentication is completed
SimpleSocial
  Friends : Array
[read-only] Provide read-only access to Friends data
SimpleSocial
  socialDelegate : ISocial
[read-only] Provide direct access to the underlying Social API implementation.
SimpleSocial
  SOCIAL_ONGETFRIENDS : String
[read-only] Event fired when social friends have been retrieved
SimpleSocial
  socialType : String
[read-only] Provide read-only access to the Social Type of the Social API
SimpleSocial
  socialVariant : String
[read-only] Provide read-only access to the Social Type Variant of the Social API.
SimpleSocial
Public Methods
 MethodDefined by
  
SimpleSocial
  
createActivity(title:String, body:String, summary:String = null, url:String = null, media:Array = null):void
Publishes a new Activity for the current user within the social environment (if one exists).
SimpleSocial
  
getCurrentView():String
Returns the current view.
SimpleSocial
  
getFriends():void
Gets friends for current user within the social environment (if one exists).
SimpleSocial
  
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.
SimpleSocial
  
isBebo():Boolean
Determine if we are running inside bebo
SimpleSocial
  
isFacebook():Boolean
Determine if we are running inside facebook
SimpleSocial
  
isOpensocial():Boolean
Determine if we are running inside an opensocial container
SimpleSocial
  
isSocial():Boolean
Determine if we are running inside a social network
SimpleSocial
Public Constants
 ConstantDefined by
  SOCIAL_TYPE_BEBO : String = "bebo"
[static] social api bebo
SimpleSocial
  SOCIAL_TYPE_FACEBOOK : String = "facebook"
[static] social api facebook
SimpleSocial
  SOCIAL_TYPE_NONE : String = "none"
[static] social api none
SimpleSocial
  SOCIAL_TYPE_OPENSOCIAL : String = "opensocial"
[static] social api opensocial
SimpleSocial
Property detail
ACTIVITY_CREATEDproperty
ACTIVITY_CREATED:String  [read-only]

Event fired when an activity has been created

Implementation
    public function get ACTIVITY_CREATED():String

Example
The following code prints out a message to the console when a social activity is created in Facebook
  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");
  }
 

AUTHENTICATION_COMPLETEproperty 
AUTHENTICATION_COMPLETE:String  [read-only]

Event fired when authentication is completed

Implementation
    public function get AUTHENTICATION_COMPLETE():String

Example
The following code prints displays an alert when the widget is authenticated in facebook
  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!");
  }
 

Friendsproperty 
Friends:Array  [read-only]

Provide read-only access to Friends data

Implementation
    public function get Friends():Array
socialDelegateproperty 
socialDelegate:ISocial  [read-only]

Provide direct access to the underlying Social API implementation. This is useful in cases where you wish to call APIs specific to the underlying service.

Implementation
    public function get socialDelegate():ISocial
SOCIAL_ONGETFRIENDSproperty 
SOCIAL_ONGETFRIENDS:String  [read-only]

Event fired when social friends have been retrieved

Implementation
    public function get SOCIAL_ONGETFRIENDS():String

Example
The following code prints out a single friend uid to the console when the user's friends have been retreived
  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 {
   widget.debug(widget.social.Friends[0]);
  }
 

socialTypeproperty 
socialType:String  [read-only]

Provide read-only access to the Social Type of the Social API

Implementation
    public function get socialType():String
socialVariantproperty 
socialVariant:String  [read-only]

Provide read-only access to the Social Type Variant of the Social API. For opensocial, this corresponds to the container (orkut, ning, myspace, etc...)

Implementation
    public function get socialVariant():String
Constructor detail
SimpleSocial()constructor
public function SimpleSocial(_widget:Widget)Parameters
_widget:Widget
Method detail
createActivity()method
public function createActivity(title:String, body:String, summary:String = null, url:String = null, media:Array = null):void

Publishes a new Activity for the current user within the social environment (if one exists). Fires an ACTIVITY_CREATED event upon response.

Parameters
title:String
 
body:String
 
summary:String (default = null)
 
url:String (default = null)
 
media:Array (default = null)

See also

getCurrentView()method 
public function getCurrentView():String

Returns the current view. On Myspace, for example, this would be 'home','canvas', or 'profile'

Returns
String

See also

getFriends()method 
public function getFriends():void

Gets friends for current user within the social environment (if one exists). Fires an SOCIAL_ONGETFRIENDS event upon response.

See also

getParameter()method 
public function 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.

Parameters
parameter_name:String — The name of the social parameter to get the value for (e.g. 'fb_sig_locale').

Returns
String
isBebo()method 
public function isBebo():Boolean

Determine if we are running inside bebo

Returns
Boolean
isFacebook()method 
public function isFacebook():Boolean

Determine if we are running inside facebook

Returns
Boolean
isOpensocial()method 
public function isOpensocial():Boolean

Determine if we are running inside an opensocial container

Returns
Boolean
isSocial()method 
public function isSocial():Boolean

Determine if we are running inside a social network

Returns
Boolean
Constant detail
SOCIAL_TYPE_BEBOconstant
public static const SOCIAL_TYPE_BEBO:String = "bebo"

social api bebo

SOCIAL_TYPE_FACEBOOKconstant 
public static const SOCIAL_TYPE_FACEBOOK:String = "facebook"

social api facebook

SOCIAL_TYPE_NONEconstant 
public static const SOCIAL_TYPE_NONE:String = "none"

social api none

SOCIAL_TYPE_OPENSOCIALconstant 
public static const SOCIAL_TYPE_OPENSOCIAL:String = "opensocial"

social api opensocial