Packageyourminis.api
Classpublic class Widget
InheritanceWidget Inheritance flash.display.Sprite
Implementsyourminis.api.IWidget

Main Widget Class that provides an ActionScript 3 API to the yourminis Widget Platform.


Example
This is the minimal code necessary to initialize and hook into the widget API
  import yourminis.api.IWidget
  var widget:IWidget;
  addEventListener("widget-loaded",onWidgetLoaded);
  
  function onWidgetLoaded(evt:Event)
  {
   widget.initWidget(300,250,0x000000); //Initialize the widget at dimensions of 300x250 with theme color of black
   //your widget has started and is ready for display
  }
 

The following code will parse an rss feed and display the title and description of each item in a text field
  import yourminis.api.IWidget
  var widget:IWidget;
  var rss;
  addEventListener("widget-loaded",onWidgetLoaded);
  
  function onWidgetLoaded(evt:Event)
  {
   widget.initWidget(300,250,0x000000);
   //your widget has started and is ready for display
   rss = widget.newRSS();
   rss.addEventListener(Event.COMPLETE,onRSSLoaded);
   rss.load(new URLRequest("http://feeds.feedburner.com/yourminis"));
  }
  
  function onRSSLoaded(evt:Event)
  {
   var loader:URLLoader = URLLoader(evt.target);
   
   namespace dc="http://purl.org/dc/elements/1.1/";
   namespace content="http://purl.org/rss/1.0/modules/content/";
   namespace geo="http://www.w3.org/2003/01/geo/wgs84_pos#";
   
   var rssxml:XML = XML(loader.data);
   
   var str = "";
   for each (var item:XML in rssxml..item)
   {
    str+="<b><a href='" + item.link + "' target='_blank'><u>" + item.title + "</u></a></b>";
    str+="<br/>" + item.description + "<br/><br/>";
    
   }
   output_txt.htmlText = str;
  }
 

See also

http://www.yourminis.com/developers


Public Properties
 PropertyDefined by
  air : Boolean
[read-only] Adobe AIR(TM) widget flag, true if the widget is running as an AIR applet
Widget
  ajax : Boolean
[read-only] ajax widget flag, true if the widget is in the ajax container
Widget
  allowFullScreen : Boolean
Allow the widget to go into full screen mode if set to true when copied (wont work on MySpace)
Widget
  api : IApiBase
[read-only] Provides REST API access to the yourminis widget server
Widget
  APIWidget : Boolean
[read-only] API widget flag
Widget
  bgcolor : uint
The background color of the widget.
Widget
  chrome : IChrome
[read-only] Provide access to Chrome API
Widget
  compiler : Boolean
[read-only] compiler widget flag, true if the widget is in the compiler sandbox on the developer site
Widget
  content : *
[read-only] Provide read-only access to the content of the widget
Widget
  debugMode : Boolean
If set to true, the widget will output widget.debug() commands to your browser's debug console.
Widget
  DROPDOWN_LOADED : String
[read-only] Event fired when the Widget dropdown is finished loading
Widget
  embedded : Boolean
[read-only] embedded widget flag, true if the widget is embedded (not in a sandbox)
Widget
  guid : String
[read-only] Provide read-only access to the guid setting
Widget
  height : Number
The height of the widget, in pixels.
Widget
  hostname : String
[read-only] Provide read-only access to the API hostname
Widget
  libraries : Object
[read-only] Provide read-only access to the dynamic libraries
Widget
  LIBRARIES_LOADED : String
[read-only] Event fired when the required libraries are finished loading
Widget
  loading : Boolean
The loading indicator.
Widget
  macdashboard : Boolean
[read-only] Mac Dashboard(TM) widget flag, true if the widget is on the mac dashboard
Widget
  reporting : IReporting
[read-only] Provide access to the Reporting API
Widget
  reportingEnabled : Boolean
[read-only] reportingEnabled flag
Widget
  sandbox : Boolean
[read-only] sandbox widget flag, true if the widget is in a sandbox
Widget
  settings : Object
[read-only] Provides read-only access to the settings array, which stores all of the widget settings
Widget
  SETTINGS_UPDATED : String
[read-only] Event fired when the widget updates a setting
Widget
  social : ISocial
[read-only] Provide access to the Social API
Widget
  STAGE_MOUSEOUT : String
[read-only] Event fired when the mouse leaves the widget display area
Widget
  STAGE_MOUSEOVER : String
[read-only] Event fired when the mouse enters the widget display area
Widget
  startpage : Boolean
[read-only] startpage widget flag, true if the widget is on a startpage
Widget
  statshostname : String
[read-only] Provide read-only access to the API statshostname
Widget
  swfhost : String
[read-only] Provide read-only access to the Widget hostname
Widget
  syndication : ISyndication
[read-only] Provide access to the Syndication API
Widget
  SYNDICATION_LOADED : String
[read-only] Event fired when the widget syndication has loaded
Widget
  testpanel : Boolean
[read-only] testpanel widget flag, true if the widget is in the Flash IDE Widget Test Panel
Widget
  title : String
[read-only] Provide read-only access to the title setting
Widget
  tooltip : Object
[read-only] Provide access to the tooltip
Widget
  uri : String
[read-only] Provide read-only access to the uri setting
Widget
  vista : Boolean
[read-only] Windows Vista(TM) widget flag, true if the widget is on the Vista Sidebar
Widget
  WIDGET_CLOSING : String
[read-only] Event fired when the widget is about to close (to allow opportunity to close streams);
Widget
  WIDGET_COPIED : String
[read-only] Event fired when the Widget has successfully copied to another location
Widget
  WIDGET_FULLSCREEN : String
[read-only] Event fired when fullscreen mode is toggled on
Widget
  WIDGET_LOADED : String
[read-only] Event fired when the Widget is finished loading
Widget
  WIDGET_NOTFULLSCREEN : String
[read-only] Event fired when fullscreen mode is toggled off
Widget
  WIDGET_RESIZED : String
[read-only] Event fired when the Widget has been resized
Widget
  WIDGET_THEMED : String
[read-only] Event fired when the Widget theme has changed
Widget
  width : Number
The width of the widget, in pixels.
Widget
  yahoo : Boolean
[read-only] Yahoo Widgets(TM) widget flag, true if the widget is running on the Yahoo Widgets platform
Widget
Public Methods
 MethodDefined by
  
Widget(__settings:Object, _widgetLocation:String)
Widget
  
addDropDownItem(title:String, data:Function = null, callback:int = null, nodeNumber:* = -1):void
Used to add items to the dropdown menu.
Widget
  
addTooltip(mc:InteractiveObject, tooltip:String, backgroundColor:Number = -1, borderColor:Number = -1, css:StyleSheet = null, delay:int = 1000):*
Used to add hover-over tooltips to movieclips, sprites, text, and buttons
Widget
  
alert(message:String, callback:Function = null, cancelcallback:Function = null):*
Used much like a javascript alert to display messages to the user
Widget
  
debug(msg:String):void
Call this method to trace a message (for debugging purposes).
Widget
  
displayFullScreen(evt:MouseEvent):*
Call this method to set the widget to fullscreen mode
Widget
  
getSetting(settingName:String, defaultValue:*):*
Load a widget setting
Widget
  
initWidget(_w:Number = 300, _h:Number = 250, _c:uint = 0x000000):void
Call this method after the widget is loaded to initialize its dimensions and color (only if you are using the widget.chrome)
Widget
  
navigateToURL(urlreq:URLRequest, target:String = "_blank", track:Boolean = true):void
Used to navigate the user to the URL in the browser and track.
Widget
  
newHTTP():URLLoader
HTTP Class Factory method
Widget
  
newRSS():URLLoader
RSS Class Factory method
Widget
  
requireLibrary(libraryName:String, forDomain:String = ""):void
Add a dynamically loaded library to the widget
Widget
  
setSetting(name:*, data:Boolean, init:* = false):void
Save a widget setting
Widget
Property detail
airproperty
air:Boolean  [read-only]

Adobe AIR(TM) widget flag, true if the widget is running as an AIR applet

Implementation
    public function get air():Boolean
ajaxproperty 
ajax:Boolean  [read-only]

ajax widget flag, true if the widget is in the ajax container

Implementation
    public function get ajax():Boolean
allowFullScreenproperty 
allowFullScreen:Boolean  [read-write]

Allow the widget to go into full screen mode if set to true when copied (wont work on MySpace)

Implementation
    public function get allowFullScreen():Boolean
    public function set allowFullScreen(value:Boolean):void

See also

apiproperty 
api:IApiBase  [read-only]

Provides REST API access to the yourminis widget server

Implementation
    public function get api():IApiBase
APIWidgetproperty 
APIWidget:Boolean  [read-only]

API widget flag

Implementation
    public function get APIWidget():Boolean
bgcolorproperty 
bgcolor:uint  [read-write]

The background color of the widget. It is easiest to set this using a hexadecimal value.

Implementation
    public function get bgcolor():uint
    public function set bgcolor(value:uint):void

Example
The following code prints out a message to the console when the widget enters full-screen mode
  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.bgcolor = 0x00FF00;
  }
 

chromeproperty 
chrome:IChrome  [read-only]

Provide access to Chrome API

Implementation
    public function get chrome():IChrome
compilerproperty 
compiler:Boolean  [read-only]

compiler widget flag, true if the widget is in the compiler sandbox on the developer site

Implementation
    public function get compiler():Boolean
contentproperty 
content:*  [read-only]

Provide read-only access to the content of the widget

Implementation
    public function get content():*
debugModeproperty 
debugMode:Boolean  [read-write]

If set to true, the widget will output widget.debug() commands to your browser's debug console.

Implementation
    public function get debugMode():Boolean
    public function set debugMode(value:Boolean):void

See also

DROPDOWN_LOADEDproperty 
DROPDOWN_LOADED:String  [read-only]

Event fired when the Widget dropdown is finished loading

Implementation
    public function get DROPDOWN_LOADED():String

Example
The following code adds several dropdown menu items
  import yourminis.api.IWidget
  var widget:IWidget;
  addEventListener("widget-loaded",onWidgetLoaded);
  function onWidgetLoaded(evt:Event):void {
   widget.addEventListener(widget.DROPDOWN_LOADED,onDropDownLoaded);
   widget.debugMode = true;
   widget.initWidget(300,250,0x000000);
  }
  function onDropDownLoaded(evt:Event):void {
   widget.addDropDownItem("item 1", "a", myfunction);
   widget.addDropDownItem("item 2", "b", myfunction);
   widget.addDropDownItem("item 3", "c", myfunction);
   widget.addDropDownItem("submenu item 1","d",myfunction,1);
   widget.addDropDownItem("submenu item 2","e",myfunction,1);
  }
  function myfunction(param:String) {
   widget.debug(param);
  }
 

embeddedproperty 
embedded:Boolean  [read-only]

embedded widget flag, true if the widget is embedded (not in a sandbox)

Implementation
    public function get embedded():Boolean
guidproperty 
guid:String  [read-only]

Provide read-only access to the guid setting

Implementation
    public function get guid():String
heightproperty 
height:Number  [read-write]

The height of the widget, in pixels. Note that the actual height of the widget container will be increased by 10 pixels if the drop-shadow is enabled.

Implementation
    public function get height():Number
    public function set height(value:Number):void

See also

hostnameproperty 
hostname:String  [read-only]

Provide read-only access to the API hostname

Implementation
    public function get hostname():String
librariesproperty 
libraries:Object  [read-only]

Provide read-only access to the dynamic libraries

Implementation
    public function get libraries():Object
LIBRARIES_LOADEDproperty 
LIBRARIES_LOADED:String  [read-only]

Event fired when the required libraries are finished loading

Implementation
    public function get LIBRARIES_LOADED():String

Example
The following code shows how to load the facebook dynamic library
  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.libraries.facebook.lib.api_key = "5efb77b97375f66bde1ba5347f1116c8";
   widget.libraries.facebook.lib.secret = "5efb77b97375f66bde1ba5347f1116c8"; //fake key and secret
   
  }
 

loadingproperty 
loading:Boolean  [read-write]

The loading indicator. If set to true, a loading animation will play, and if set to false this animation will not be visible.

Implementation
    public function get loading():Boolean
    public function set loading(value:Boolean):void

Example
The following code prints out a message to the console when the widget enters full-screen mode
  import yourminis.api.IWidget
  var widget:IWidget;
  var counter:uint;
  addEventListener("widget-loaded",onWidgetLoaded);
  function onWidgetLoaded(evt:Event):void {
   counter = 0;
   widget.debugMode = true;
   widget.initWidget(300,250,0x000000);
   widget.loading = true;  //turn on the loading indicator
   addEventListener(Event.ENTER_FRAME, myloop);
  }
  function myloop(evt:Event) {
   counter++;
   if (counter==30) widget.loading=false;  //turn off loading indicator after 30 frames.
  }
 

macdashboardproperty 
macdashboard:Boolean  [read-only]

Mac Dashboard(TM) widget flag, true if the widget is on the mac dashboard

Implementation
    public function get macdashboard():Boolean
reportingproperty 
reporting:IReporting  [read-only]

Provide access to the Reporting API

Implementation
    public function get reporting():IReporting
reportingEnabledproperty 
reportingEnabled:Boolean  [read-only]

reportingEnabled flag

Implementation
    public function get reportingEnabled():Boolean
sandboxproperty 
sandbox:Boolean  [read-only]

sandbox widget flag, true if the widget is in a sandbox

Implementation
    public function get sandbox():Boolean
settingsproperty 
settings:Object  [read-only]

Provides read-only access to the settings array, which stores all of the widget settings

Implementation
    public function get settings():Object
SETTINGS_UPDATEDproperty 
SETTINGS_UPDATED:String  [read-only]

Event fired when the widget updates a setting

Implementation
    public function get SETTINGS_UPDATED():String

Example
The following code prints out a message to the console when a setting is updated
  import yourminis.api.IWidget
  var widget:IWidget;
  addEventListener("widget-loaded",onWidgetLoaded);
  function onWidgetLoaded(evt:Event):void {
   widget.addEventListener(widget.SETTINGS_UPDATED,onSettingsUpdated);
   widget.debugMode = true;
   widget.initWidget(300,250,0x000000);
  }
  function onSettingsUpdated(evt:Event):void {
   widget.debug("A setting has been updated");
  }
 

socialproperty 
social:ISocial  [read-only]

Provide access to the Social API

Implementation
    public function get social():ISocial
STAGE_MOUSEOUTproperty 
STAGE_MOUSEOUT:String  [read-only]

Event fired when the mouse leaves the widget display area

Implementation
    public function get STAGE_MOUSEOUT():String

Example
The following code prints out a message to the console when the cursor leaves the widget
  import yourminis.api.IWidget
  var widget:IWidget;
  addEventListener("widget-loaded",onWidgetLoaded);
  function onWidgetLoaded(evt:Event):void {
   widget.addEventListener(widget.STAGE_MOUSEOUT,onWidgetOut);
   widget.debugMode = true;
   widget.initWidget(300,250,0x000000);
  }
  function onWidgetOut(evt:Event):void {
   widget.debug("The cursor has left the widget area");
  }
 

STAGE_MOUSEOVERproperty 
STAGE_MOUSEOVER:String  [read-only]

Event fired when the mouse enters the widget display area

Implementation
    public function get STAGE_MOUSEOVER():String

Example
The following code prints out a message to the console when the widget hovered over
  import yourminis.api.IWidget
  var widget:IWidget;
  addEventListener("widget-loaded",onWidgetLoaded);
  function onWidgetLoaded(evt:Event):void {
   widget.addEventListener(widget.STAGE_MOUSEOVER,onWidgetOver);
   widget.debugMode = true;
   widget.initWidget(300,250,0x000000); 
  }
  function onWidgetOver(evt:Event):void {
   widget.debug("The cursor has entered the widget area");
  }
 

startpageproperty 
startpage:Boolean  [read-only]

startpage widget flag, true if the widget is on a startpage

Implementation
    public function get startpage():Boolean
statshostnameproperty 
statshostname:String  [read-only]

Provide read-only access to the API statshostname

Implementation
    public function get statshostname():String
swfhostproperty 
swfhost:String  [read-only]

Provide read-only access to the Widget hostname

Implementation
    public function get swfhost():String
syndicationproperty 
syndication:ISyndication  [read-only]

Provide access to the Syndication API

Implementation
    public function get syndication():ISyndication
SYNDICATION_LOADEDproperty 
SYNDICATION_LOADED:String  [read-only]

Event fired when the widget syndication has loaded

Implementation
    public function get SYNDICATION_LOADED():String

Example
The following code prints out a message to the console when the Syndication Panel is loaded
  import yourminis.api.IWidget
  var widget:IWidget;
  addEventListener("widget-loaded",onWidgetLoaded);
  function onWidgetLoaded(evt:Event):void {
   widget.addEventListener(widget.SYNDICATION_LOADED,onSyndicationLoaded);
   widget.debugMode = true;
   widget.initWidget(300,250,0x000000); 
  }
  function onSyndicationLoaded(evt:Event):void {
   widget.debug("Syndication Loaded");
  }
 

testpanelproperty 
testpanel:Boolean  [read-only]

testpanel widget flag, true if the widget is in the Flash IDE Widget Test Panel

Implementation
    public function get testpanel():Boolean
titleproperty 
title:String  [read-only]

Provide read-only access to the title setting

Implementation
    public function get title():String
tooltipproperty 
tooltip:Object  [read-only]

Provide access to the tooltip

Implementation
    public function get tooltip():Object
uriproperty 
uri:String  [read-only]

Provide read-only access to the uri setting

Implementation
    public function get uri():String
vistaproperty 
vista:Boolean  [read-only]

Windows Vista(TM) widget flag, true if the widget is on the Vista Sidebar

Implementation
    public function get vista():Boolean
WIDGET_CLOSINGproperty 
WIDGET_CLOSING:String  [read-only]

Event fired when the widget is about to close (to allow opportunity to close streams);

Implementation
    public function get WIDGET_CLOSING():String

Example
The following code prints out a message to the console when the widget is about to close
  import yourminis.api.IWidget
  var widget:IWidget;
  addEventListener("widget-loaded",onWidgetLoaded);
  function onWidgetLoaded(evt:Event):void {
   widget.addEventListener(widget.WIDGET_CLOSING,onWidgetClose);
   widget.debugMode = true;
   widget.initWidget(300,250,0x000000);
  }
  function onWidgetClose(evt:Event):void {
   widget.debug("Widget Closed");
  }
 

WIDGET_COPIEDproperty 
WIDGET_COPIED:String  [read-only]

Event fired when the Widget has successfully copied to another location

Implementation
    public function get WIDGET_COPIED():String

Example
The following code prints a message to the console when the widget is copied
  import yourminis.api.IWidget
  var widget:IWidget;
  addEventListener("widget-loaded",onWidgetLoaded);
  function onWidgetLoaded(evt:Event):void {
   widget.addEventListener(widget.WIDGET_COPIED,onWidgetCopied);
   widget.debugMode = true;
   widget.initWidget(300,250,0x000000);
  }
  function onWidgetCopied(evt:Event):void {
   widget.debug("Widget Copied");
  }
 

WIDGET_FULLSCREENproperty 
WIDGET_FULLSCREEN:String  [read-only]

Event fired when fullscreen mode is toggled on

Implementation
    public function get WIDGET_FULLSCREEN():String

Example
The following code prints out a message to the console when the widget enters full-screen mode
  import yourminis.api.IWidget
  var widget:IWidget;
  addEventListener("widget-loaded",onWidgetLoaded);
  function onWidgetLoaded(evt:Event):void {
   widget.debugMode = true;
   widget.allowFullScreen = true; //allows the widget to take up the entire screen
   widget.addEventListener(widget.WIDGET_FULLSCREEN,onFullScreen);
   widget.addEventListener(widget.WIDGET_NOTFULLSCREEN,onNotFullScreen);
   widget.initWidget(300,250,0x000000);
   var s = new Sprite();
   s.graphics.beginFill(0xFF0000);
   s.graphics.drawRect(10,10,100,100);
   s.graphics.endFill();
   addChild(s);
   s.addEventListener(MouseEvent.CLICK, widget.displayFullScreen); //when the sprite s is clicked, fullscreen mode will toggle
  }
  function onFullScreen(evt:Event):void {
   widget.debug("Widget is in fullscreen mode");
  }
  function onNotFullScreen(evt:Event):void {
   widget.debug("Widget is not in fullscreen mode");
  }
 

WIDGET_LOADEDproperty 
WIDGET_LOADED:String  [read-only]

Event fired when the Widget is finished loading

Implementation
    public function get WIDGET_LOADED():String

Example
The following code prints a message to the console when the widget is loaded
  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.debugMode = true;
   widget.debug("Widget Loaded");
  }
 

WIDGET_NOTFULLSCREENproperty 
WIDGET_NOTFULLSCREEN:String  [read-only]

Event fired when fullscreen mode is toggled off

Implementation
    public function get WIDGET_NOTFULLSCREEN():String

See also

WIDGET_RESIZEDproperty 
WIDGET_RESIZED:String  [read-only]

Event fired when the Widget has been resized

Implementation
    public function get WIDGET_RESIZED():String

Example
The following code prints out a message to the console when the widget is resized
  import yourminis.api.IWidget
  var widget:IWidget;
  addEventListener("widget-loaded",onWidgetLoaded);
  function onWidgetLoaded(evt:Event):void {
   widget.addEventListener(widget.WIDGET_RESIZED,onWidgetResized);
   widget.debugMode = true;
   widget.initWidget(300,250,0x000000); 
  }
  function onWidgetResized(evt:Event):void {
   widget.debug("Widget resized to: " + widget.width + " by " + widget.height); 
  }
 

WIDGET_THEMEDproperty 
WIDGET_THEMED:String  [read-only]

Event fired when the Widget theme has changed

Implementation
    public function get WIDGET_THEMED():String

Example
The following code prints out a message to the console when the widget theme color is changed
  import yourminis.api.IWidget
  var widget:IWidget;
  addEventListener("widget-loaded",onWidgetLoaded);
  function onWidgetLoaded(evt:Event):void {
   widget.addEventListener(widget.WIDGET_THEMED,onWidgetThemed);
   widget.debugMode = true;
   widget.initWidget(300,250,0x000000); 
  }
  function onWidgetThemed(evt:Event):void {
   widget.debug("Widget Theme Color is: " + widget.widgetColor); 
  }
 

widthproperty 
width:Number  [read-write]

The width of the widget, in pixels. Note that the actual width of the widget container will be increased by 10 pixels if the drop-shadow is enabled.

Implementation
    public function get width():Number
    public function set width(value:Number):void

See also

yahooproperty 
yahoo:Boolean  [read-only]

Yahoo Widgets(TM) widget flag, true if the widget is running on the Yahoo Widgets platform

Implementation
    public function get yahoo():Boolean
Constructor detail
Widget()constructor
public function Widget(__settings:Object, _widgetLocation:String)Parameters
__settings:Object
 
_widgetLocation:String
Method detail
addDropDownItem()method
public function addDropDownItem(title:String, data:Function = null, callback:int = null, nodeNumber:* = -1):void

Used to add items to the dropdown menu.

Parameters
title:String — The title of the menu item.
 
data:Function (default = null) — data object to pass to the callback function.
 
callback:int (default = null) — A callback function to call when the item is clicked.
 
nodeNumber:* (default = -1) — If a secondary level menu is desired, specify the node of the primary menu to place this item under.

See also

addTooltip()method 
public function addTooltip(mc:InteractiveObject, tooltip:String, backgroundColor:Number = -1, borderColor:Number = -1, css:StyleSheet = null, delay:int = 1000):*

Used to add hover-over tooltips to movieclips, sprites, text, and buttons

Parameters
mc:InteractiveObject — The InteractiveObject to add a tooltip to.
 
tooltip:String — The string you wish to display in the tooltip.
 
backgroundColor:Number (default = -1) — The background color of the tooltip. Default is 0xFFFFCC;
 
borderColor:Number (default = -1) — The border color of the tooltip. The default is 0x000000.
 
css:StyleSheet (default = null) — The StyleSheet of the tooltip's text. The default is null, which is internally re-evaluated as: css.setStyle("tooltip",{fontFamily:'Verdana', fontSize:'9px', color:'#000000', fontWeight:'normal', display:'inline'}).
 
delay:int (default = 1000) — The delay in miliseconds before the tooltip appears on hover over. Default is 1000 (one second).

Returns
*

Example
The following code adds a tooltip to my_button that says "Click me!" when hovered over
  import yourminis.api.IWidget
  var widget:IWidget;
  addEventListener("widget-loaded",onWidgetLoaded);
  function onWidgetLoaded(evt:Event) {
   widget.initWidget(300,250,0x000000);
   var tt:StyleSheet = new StyleSheet();
   tt.setStyle("myStyleSheetName",{fontFamily:'Verdana', fontSize:'9px', color:'#FF0000', fontWeight:'normal', display:'inline'});
   widget.addTooltip(my_btn,"This is a test",0x0000FF,0x00FF00,tt);
  }
 

alert()method 
public function alert(message:String, callback:Function = null, cancelcallback:Function = null):*

Used much like a javascript alert to display messages to the user

Parameters
message:String — The text to display in the alert
 
callback:Function (default = null) — Optional. The callback function for when the alert is closed.
 
cancelcallback:Function (default = null)

Returns
*

Example
The following code tracks a URL request and opens it in the user's browser
  import yourminis.api.IWidget
  var widget:IWidget;
  addEventListener("widget-loaded",onWidgetLoaded);
  function onWidgetLoaded(evt:Event) {
   widget.initWidget(300,250,0x000000);
   widget.alert("This is a test!");
  }
 

debug()method 
public function debug(msg:String):void

Call this method to trace a message (for debugging purposes). Note: widget.debugMode must be set to true to get debug statements outside of the Widget Test Panel

Parameters
msg:String — the desired message to log

See also


Example
The following example shows how to trace "Hello World!" in the debug console of the Widget Test Panel:
   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("Hello World!"); //Prints out to your browser's debug console (i.e. Firebug in Firefox)
   }
  

displayFullScreen()method 
public function displayFullScreen(evt:MouseEvent):*

Call this method to set the widget to fullscreen mode

Parameters
evt:MouseEvent

Returns
*

See also

getSetting()method 
public function getSetting(settingName:String, defaultValue:*):*

Load a widget setting

Parameters
settingName:String — The name of the setting to retrieve
 
defaultValue:* — The default value if the setting does not exist

Returns
*

See also


Example
Example to get a widget setting
   import yourminis.api.IWidget
   var widget:IWidget;
   addEventListener("widget-loaded",onWidgetLoaded);
   function onWidgetLoaded(evt:Event)
   {
    widget.initWidget(300,250,0x000000);
    var playerid = widget.getSetting("playerid",null);
    //do something with player id
   }
  

initWidget()method 
public function initWidget(_w:Number = 300, _h:Number = 250, _c:uint = 0x000000):void

Call this method after the widget is loaded to initialize its dimensions and color (only if you are using the widget.chrome)

Parameters
_w:Number (default = 300) — The desired width
 
_h:Number (default = 250) — The desired height
 
_c:uint (default = 0x000000) — The desired color

See also


Example
The following code prints a message to the console when the widget is loaded
  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); //Initialize the widget with dimensions 300x250 and theme color of black
  }
 

navigateToURL()method 
public function navigateToURL(urlreq:URLRequest, target:String = "_blank", track:Boolean = true):void

Used to navigate the user to the URL in the browser and track. (required for external URL support in myspace.com)

Parameters
urlreq:URLRequest — The URL to navigate to and optionally track
 
target:String (default = "_blank") — An optional parameter to specify the target window name
 
track:Boolean (default = true) — An optional parameter to enable/disable tracking

See also


Example
The following code tracks a URL request and opens it in the user's browser
  import yourminis.api.IWidget
  var widget:IWidget;
  addEventListener("widget-loaded",onWidgetLoaded);
  function onWidgetLoaded(evt:Event) {
   widget.initWidget(300,250,0x000000);
   widget.navigateToURL(new URLRequest("http://www.yourminis.com/developers/"));
  }
 

newHTTP()method 
public function newHTTP():URLLoader

HTTP Class Factory method

Returns
URLLoader — HTTP Object for http related widget requests

Example
The following code tracks a URL request and opens it in the user's browser
  import yourminis.api.IWidget
  var widget:IWidget;
  addEventListener("widget-loaded",onWidgetLoaded);
  function onWidgetLoaded(evt:Event) {
   widget.initWidget(300,250,0x000000);
   var http = widget.newHTTP();
   http.addEventListener(Event.COMPLETE,onHttpLoaded);
   http.load(new URLRequest("http://feeds.feedburner.com/yourminis"));
  }
  function onHttpLoaded(evt:Event) {
   var loader:URLLoader = URLLoader(evt.target);
   trace(loader.data.toString());
   //your code here to handle the loaded data
  }
 

newRSS()method 
public function newRSS():URLLoader

RSS Class Factory method

Returns
URLLoader — RSS Object for RSS related widget requests

See also


Example
The following code will parse an rss feed and display the title and description of each item in a text field
  var rss;
  import yourminis.api.IWidget
  var widget:IWidget;
  addEventListener("widget-loaded",onWidgetLoaded);
  function onWidgetLoaded(evt:Event) {
   widget.initWidget(300,250,0x000000);
   widget.debugMode = true;
   rss = widget.newRSS();
   rss.addEventListener(Event.COMPLETE,onRSSLoaded);
   var myurl = "http://feeds.feedburner.com/yourminis";
   rss.load(new URLRequest(myurl));
   
   //if you wanted to load a feed that required authorization, you would do the following:
   //rss.loadRSS("myURL","myUserName","myPassword") where
   //"myURL" is a string containing the URL you wish to load
   //"myUserName" is a string containing the username to log in with
   //"myPassword" is a string containing the password to log in with
  }  
  function onRSSLoaded(evt:Event)
  {
   var loader:URLLoader = URLLoader(evt.target);
   
   namespace dc="http://purl.org/dc/elements/1.1/";
   namespace content="http://purl.org/rss/1.0/modules/content/";
   namespace geo="http://www.w3.org/2003/01/geo/wgs84_pos#";
   
   var rssxml:XML = XML(loader.data);
   
   var str = "";
   for each (var item:XML in rssxml..item)
   {
    str+="<b><a href='" + item.link + "' target='_blank'><u>" + item.title + "</u></a></b>";
    str+="<br/>" + item.description + "<br/><br/>";
    
   }
   widget.debug(str);
  }
 

requireLibrary()method 
public function requireLibrary(libraryName:String, forDomain:String = ""):void

Add a dynamically loaded library to the widget

Parameters
libraryName:String — The name of the libarary to load ("facebook", "opensocial", etc.)
 
forDomain:String (default = "") — The domains for which the widget should load the library. " will always load the library, and if the parameter is omitted, it will default to loading only on the domain associated with the library name (i.e. "facebook.com" for "facebook")

See also


Example
Example to set widget setting
   import yourminis.api.IWidget
   var widget:IWidget;
   addEventListener("widget-loaded",onWidgetLoaded);
   function onWidgetLoaded(evt:Event)
   {
    widget.initWidget(300,250,0x000000);
    widget.addEventListener(widget.LIBRARIES_LOADED, onLibrariesLoaded);
    widget.requireLibrary("facebook",");
   }
   function onLibrariesLoaded(evt:Event):void{
    //widget.libraries.facebook.lib is ready to use
   }
  

setSetting()method 
public function setSetting(name:*, data:Boolean, init:* = false):void

Save a widget setting

Parameters
name:* — The name of the setting to retrieve
 
data:Boolean — The value of the setting
 
init:* (default = false)

See also


Example
Example to set widget setting
   import yourminis.api.IWidget
   var widget:IWidget;
   addEventListener("widget-loaded",onWidgetLoaded);
   function onWidgetLoaded(evt:Event)
   {
    widget.initWidget(300,250,0x000000);
    var playerid = widget.getSetting("playerid",null);
    if (playerid==null)
    {
     setSetting("playerid","0");
     playerid=0;
    }
   }