Monday, February 26, 2007

Get Ready for the Election!

Thanks to Developer Michael Ayers and Designers Lani Mathis and Drew Turner from the SpringWidgets team, you can now support your candidate for the 2008 Election on your Blog or Profile. So go out to SpringWidgets.com and Start Sharing It!
   

Saturday, January 13, 2007

What are Widget Parameters and How Do I Implement them?

If you’re a Flash Developer and you’ve started checking out our SDK, you may have stumbled across parameters in the documentation and you may have wondered about the bigger picture.

Widget Parameters, in the context of the SpringWidgets Platform, are values for variables inside your widget that are defined during initialization of your widget. They work very similar to the way query string variables are used by back-end scripts to determine the content on web pages. In fact, Flash uses query string variables also, to pass in initial variables into the _root of a Flash file; they can be found either appended to the .swf URL or defined on their own in the flashvars attribute.

There are some differences/enhancements that parameters in the SpringWidgets Platform offer. They are not stored in the _root, but rather are accessed through the API using two methods: Widget.getParameter(); and Widget.setParameter(object); - these two methods work identically on both the desktop and the Web. Values of parameters can change during the lifetime of a widget instance. Most importantly, the parameters are packed into a single object with developer defined properties.

The parameters can be used to determine:

  • content (e.g. by passing in data ids or usernames)

  • initial state of the widget (e.g. by defining the tab that should be selected initially)

  • skins (e.g. by passing in a Jpeg URL)

  • anything else your widget needs


Situations in which your widget could receive parameters:

  • When a Widget embedded on a Webpage is loaded.

  • When a Widget is popped from a webpage (Note: the current parameter values are passed down to the desktop, not the initial values. This means your code can change the parameters as the user interacts with the widget on the web and can pass those changes down to the desktop when popped, rather than loosing them, in which case the user would have to resubmit the same data again on the desktop)

  • When a widget, that was left open when the application was closed, is launched when TheSpringBox is launched. TheSpringBox remembers widget parameters on shutdown and passes the back in when it “revives” the widget



Situation in which your code should update parameters are any events that occur in your widget that allow you to define the state in which your widget is in, e.g. current tab.

Once you have defined the parameters that your widget will receive, you can test your widget by using the Web Simulator that comes with our SDK. For testing purposes it allows you to declare the parameters that are passed into the widget. The panel will also give you insight on the current values of your parameters; this is helpful should your code alter them while the widget is running or is interacted with.

When you upload your widget to the SpringWidgets site (availability TBD) you will also find an interface with which you will be able to define your parameters, their respective data types and default values. This will define the customization form on your widget’s Share It! page, that user can use to mold your widget to their needs.



Example:


Let us assume we are creating a simple Stock Ticker widget that has 2 tabs; one for a quote and one for a chart. Users wanting to place this widget on there site may want to control two aspects: (1) the stock to be displayed, (2) the default tab.

Let us define 2 parameters: ticker and tab. We would access these values in an initialization function in our widget:

function initialization()
{
    var param = Widget.getParameter();

    if(param.ticker != undefined)
    {
        // can be any ticker symbol e.g. “GOOG”
        setTicker(param.ticker);
    }

    // can either be “quote” or “chart”
    setTab(param.tab);
}

You may wish you constantly update the value of the tab parameter every time the user changes the tab. This way, when the user changes the tab on the web and pops the widget, it will pop to the correct tab. Also, this allows you to maintain the state of a widget’s instance when the application restarts.


btnTabChart.onRelease = function()
{
    setTab(“chart”);

    // read the current parameter object
    // and change only the tab property
    var param = Widget.getParameter();
        param.tab = “chart”;

    // write it back
    Widget.setParameter(param);
};

Monday, November 13, 2006

Creating an OPML File for your RSS Reader

Some of you may have more than one feed to place into your widget, in that case you could choose to list all your feeds and separate them with a pipe character - see Previous Post for more details.

But there is another solution which may, in most cases, give you more flexibility and control over the content of your widget instance(s). The solution is leveraging the RSS Reader widget's OPML support and will allow you to add not only RSS Feeds but also text labels, nested folders, hyperlinks. You can also include nested OPML files that will function like folders, but really are separate files - thus reducing the file size of the initial feed.

You will need:


  • web storage to host your OPML feed(s)

  • text editor (e.g. Notepad) to author your feed



Below you will find a sample OPML feed that I put together which is hosted on this domain. (View in New window.)



So what are you seeing? The gist is fairly simple. You have a <head> and <body> tag wrapped in an <opml> tag, just like HTML; the <body> tag only contains <outline> elements. The outlines contain text attributes that define the label if the item. The chart below shows the types of items that can be placed into a feed and how they need to be implemented.

DescriptionAttributesIcon
typeurltext
Text*--Plain Text-
Folder*--Folder LabelFolder
HyperlinklinkWeb URLLabel for LinkArrow
RSS FeedrssFeed URLTitle of feedRSS Logo
OPML FeedincludeOPML URLTitle of feedOPML Logo

* These items my appear the same. the differance becomes evidant in the implemenation: A text item is essentially a folder with no child outlines. When an outline node has child outlines, it turns into a folder.

Now that you have your feed, upload the xml file to your web storage. Go to this page to preview and publish your widget. Paste the path to the OPML feed you just uploaded in the parameter field. Select a publish option and your done.

...and here's the result:

Sunday, November 12, 2006

Adding Multiple feeds to your RSS Reader on your Web page.

Adding multiple feeds to the RSS Reader on your page is easy. First, go to the Share RSS Reader page. After choosing a size for your Widget, add your feed URLs as a parameter. If you wish to add multiple feeds, list them all and separate them with a pipe ("|", key under the backspace button) character.

Your parameter field should then look something like this:

http://feeds.feedburner.com/springwidgetsun
leashed|http://feeds.feedburner.com/blogspo
t/NIxG|http://www.thespringbox.com/rss/dail
yrss.xml

...and here's the result:

Friday, November 10, 2006

Creating branded Feeds with SpringWidgets + Feedburner

Many of you are probably seeing a bunch of RSS Readers popping up on various sites with branded feeds and you're asking yourself "How do I put a branded feed on my blog?" Well, thanks to a partnership with Feedburner, it's very simple!

You will need:

  • feed of your content, RSS or ATOM ok

  • 480x75 px JPG

  • Free Feedburner account

  • Webpage that allows Flash content to put it on.



First, create your 480x75 JPG. Make sure your branding is centered inside it and no larger than 150px wide. Find a place to host it on the internet. If you don't have a server or web space, you can use MySpace. After you upload, you can right-click and get its Properties to verify the size. The Properties will also give you it URL - this is the image URL you will submit on your Feedburner page.

Next, create a Feedburner account, if you don't already have one. On your "My Feeds" page submit your RSS or ATOM feed. Once submitted you will see a set of tabs for that particular feed. Click the "Publicize" tab and then click on "SpringWidgets Skin" in the left column. In the text field "Widget Logo URL", paste the image URL from step one. After you submit it you will see a preview of your widget below it.

Feedburner has now created a new URL for your feed that has the brand embedded into it. You will need to get this new URL; it should look something like this. http://feeds.feedburner.com/SpringwidgetsUnleashed (Note the domain feeds.feedburner.com)

Lastly, visit the Share It! page for the RSS Reader and paste you Feedburner feed URL in the "Param" field in the left column. Below it you can then select the tab that corresponds to the place where you wish to place it (e.g. MySpace), or you can select HTML (tab with "<h>") and copy/paste it manually into your page. This can be a MySpace profile, a blog post or you can even insert it into your Blogger template.

If your branding doesn’t come up immediately, give it a few minutes.

...and here's the result:



Further Reading:
- FeedBurner + SpringWidgets Overview

Monday, November 06, 2006

WidgetsLive 2006

We did well. Dan Strauss, Don Synstelien and I were presenting at WidgetsLive 2006 in San Francisco this morning where we officially announced the release of SpringWidgets in front of an audience of many passionate widget developers.

I was very happy to see so many interesting presentations; kudos to Om and Niall for organizing this event and for giving us a spot in the keynote.