Flex/Flash

Populating A TileList On Creation Complete Using XML In Flex

7th November 2008 - 5 minutes read time

A TileList is part of a group of elements that allow you to add components in a specific order and orientation. The TileList controls the displaying of a number of items set out as tiles and so it best suited to displaying images as thumbnails.

There are many ways to do this, but none of the examples on the Flex site seemed to be very useful, or very well explained. What I wanted to do was to create a TileList that displayed the tiles in a certain way and used an XML file to fill up the list of items with images, each image having a label associated with it.

The first thing to do is to create the TileList element.

<mx:TileList id="imageTileList"
itemRenderer="CustomItemRenderer"
dataProvider="{theImages}"
width="200"
height="400"
columnCount="2"
creationComplete="initList();"/>

This contains three important attributes, which I have described here.

The Script Element, Adding An Action To A Button And Functions In Flex

5th November 2008 - 3 minutes read time

Yesterday I talked about creating some simple Flex elements in your application. Today I will introduce a new element called Script.

The Script element, if you haven't already guessed is used to run your application function and should be contained within the Application element. You can either put script inline like this.

<mx:Script>
// some code here
</mx:Script>

Or you can use the source attribute and link it with an external ActionScript source file.