Developer Network Home  Help 

YDN Flash Developer Center Badge Kit Simple Badge with URL Service
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.


Simple URL Badge Example

Simple Badge with URL Service

Now that we went through the Simple Badge and Simple Badge with Overlay examples, let's add a service component to our badge. The service we'll add is a URLService, one that allows the badge to send a URL to the browser to open it. While this service is not a data service (i.e., no data is exchanged with the server), it's simple and allows us to see how services are used.

Nothing new has been added to the config.xml file, so we don't need to look at it again. Let's proceed directly to content.xml:

Notice that we added a third section to the badge, namely the services. There, we defined one service (note that we are using the full classpath for the service; we could have also used the classpaths section of config.xml to import these classpaths and simply use "URLService" instead.)

In the UI, we have a text input field and a button. When clicked, the button assigned the text from the text input field to the urlService.url parameter and directs the service to trigger by setting its send property to true. Simple and clean, and we have a badge that loads a URL specified by the user!