Developer Network Home  Help 

YDN Flash Developer Center Badge Kit Flickr Badge Example
Flash Developer Center

ASTRA Badge Kit Examples

The Badge Kit comes with a set of examples that ease you into using it, introducing data services, and show you how to extend the Badge Kit.


Flickr Badge Example

Flickr Badge

The Flickr Badge displays a few of the latest photos for a particular Flickr user. It's a small application that can embedded into pages to showcase recent images and lead the viewer back to Flickr.

First, let's take a look at the config.xml file for the Flickr badge. A particular point of interest here is the <animations> section:

This section defines transitions that we can use in conjunction with UI elements in the badge. Each UI element has two properties: onShow and onHide -- these can be assigned the id fields of animations specified above to produce animated appearance and disappearance effects.

In the content.xml file, we first define the resources our badge uses:

In this badge, we are only using two of the base components: Image and Label. Although the base_components.swf we are using contains all of the base components, it can be modified and recompiled to only contain the components used in the project.

Next, we specify the services used in the badge:

Since this is a Flickr badge, we are using just one service, the flickrService, which is among the supplied services in base_components.swf. Note that on the result event, the source field of multiple images (defined further in the elements section) is assigned to specific values retrieved from the flickrService. Also note that we dispatch the send call to the service immediately at initialization (since we already have all the parameters needed to make the service call).

Now let's take a look at the <elements> section of the badge:

There are 8 thumbnails, which are all assigned values by the flickrService in its _result_event. We are only showing one of the eight thumbnails above, for brevity. Let's look at the attributes assigned to the element:

The next set in the elements section is an overlay container. Container is a special type of element that allows users to group other elements together. In this case, the container has a background, and a full size image, whose source is assigned when thumbnails are clicked. Note that the fullimage component renders its parent container visible when it loads.

And that's all there is to the Flickr badge!