Archive for February 15th, 2008

15
Feb

Creating a simple image gallery with the Flex HorizontalList control

This request comes to us from a faithful reader who was wondering how you can display a full image when a user clicks on a thumbnail in a HorizontalList control in Flex. My solution was to put the thumbnail image and full image URLs in the data provider and then use bindings to the HorizontalList control’s selectedItem property.

Full code after the jump.

Continue reading ‘Creating a simple image gallery with the Flex HorizontalList control’

15
Feb

Creating timers using the setTimeout method

In a previous example, “Creating timers using the setInterval() method”, we saw how you can create a repeating timer using the setInterval() method.

In the following example, you will see how to create and cancel non-repeating timers using the setTimeout() and clearTimeout() methods. You’ll also see how you can pass additional parameters to the setTimeout() method which will get passed along to your custom function.

As pointed out by a keen reader in the previous example, the setInterval() and setTimeout() methods are the non-preferred methods of timers. The new and improved method is to use the Timer class.

Full code after the jump.

Continue reading ‘Creating timers using the setTimeout method’