Flex/Flash

Posts about Flash, action script and Flex.

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.

External Script Files And Printing Objects With Flex

6th November 2008 - 4 minutes read time

Yesterday I talked about using the Flex Script element to run code within the mxml file, you can also use the source attribute of the Script element to reference external files. To create an external script file FlashDevelop go to the File->New and select Blank Document. You can also do this by pressing Ctrl+N. This will create a blank document that you must save into your src folder of your project with the extension as. Note that if you call this file "sourcefile.as" then you must reference this in your script tag like this.

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.

Creating Some Simple Flex Interface Elements

4th November 2008 - 6 minutes read time

Following on from my previous blog post about installing Flex on Windows I thought I would go through how to create an interface using mxml. When you create a Flex 3 project the first file you are given is called Main.mxml, which has the following content.

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
 
</mx:Application>

This file is used to compile and run your Flex project and is the central starting point for all the rest of the compile process. This file controls your interface of your program. At first this file might look daunting, but there are lots of elements to select from and if you know CSS then you should be somewhat familiar with how elements are coloured, padded and positioned.

Installing Flex 3 On Windows

3rd November 2008 - 4 minutes read time

Flex is a powerful SDK that allows you to build Flash applications that can then be embedded into any web page. The SDK is that Flex uses quite large and covers a whole range of things from interface controls to data processing. To program in Flex you need to use ActionScript 3. What Flex creates as output is swf files, which can be run separately or embedded into a web page.

To get started you will need the Flex SDK. Download the Flex SDK 3 zip file and extract it into a directory where you can get to it. As an example, I put mine in C:\dev\flex_sdk_3.

Create A Simple Flash Presentation

28th February 2008 - 3 minutes read time

One common thing that can be done with Flash is to create presentations. These presentations can then be exported to a swf file and viewed by just about everybody.

To make a presentation create a new flash document and create a new layer. This layer will be used to keep the next and previous buttons in a consistent place.

On the first frame add the following code to stop the animation running at the first frame.

stop();

Next, create a button that you can use for moving forward and backward through the presentation. This can be done by drawing an object on the stage, right clicking on it and selecting Convert to Symbol.... You can then add these buttons to the stage and create events for them.