Flex Examples
Right mouse click menu example
(preview)Right mouse click menu example
Ever wondered how to add your own right click menu item in the Context Menu of your Flex Application. In this example I will show you step by step how to achieve this, with ofcourse a small demo application to show the result. Step 1: Import the FlexGlobals in your Script section 12// Context Menu Import import... Read more »
Easy Unix Time Function
(preview)
Easy Unix Time Function
Today I was in need of a function that would give me the current Unix Time. It might be possible that you don’t know what the Unix Time is exactly, check out this Wikipedia article. In my need to get this time, I wrote the following quick and simple code. It’s actually only 3 lines of code... Read more »
Random number in Flex
(preview)
Random number in Flex
Every now and then you need to do something at random in your application (i.e. pick a random item from a collection). For that, you’re probably need some random number to decide which option to choose. Here is a simple example that shows you how to generate random numbers in Flex. To do this,... Read more »
Progressbar in Datagrid Example
(preview)
Progressbar in Datagrid Example
In the comments of our previous post about using the ProgressBar, one of our readers asked if a ProgressBar could be used inside a DataGrid. This is, ofcourse, possible. So we decided to write an example about this. There are a couple of things you need to know before we start: Use an ItemRenderer... Read more »
Drag and Drop from DataGrid or AdvancedDataGrid to Tree
(preview)
Drag and Drop from DataGrid or AdvancedDataGrid to Tree
One of the coolest things in Flex is the ability to create Drag and Drop operations very easily. For List base controls like the List and DataGrid / AdvancedDataGrid, it works out of the box, just set the dragEnabled property of the source and the dropEnabled property of the other and it’s already... Read more »
Style AdvancedDataGrid depending on data example
(preview)
Style AdvancedDataGrid depending on data example
Besides displaying Trees, SummaryRows and stuff like that, the AdvancedDataGrid has another nice feature the standard DataGrid doesn’t have: a styleFunction! Using that we can style the label as we like for each column in each row. Take a look at the following example to find out how its done. Ok... Read more »
Set custom cursor using the CursorManager
(preview)
Set custom cursor using the CursorManager
After my previous post about setting the busy cursor, I decided to write a next post about custom Cursors. In our example we use an Image as a Cursor source, but you can also use a SWF file. The CursorManager allows you to use your custom cursors in a very simple way. The most important method is the... Read more »
Set busy Cursor using the CursorManager
(preview)
Set busy Cursor using the CursorManager
There are multiple ways to show that your Flex Application is busy, one of the nicest is showing the busy cursor. This is very easy within Flex since you can use the CursorManager component. The only source code you need is: 1CursorManager.setBusyCursor(); This is a static method of the CursorManager... Read more »
ArrayCollection Filter Example
(preview)
ArrayCollection Filter Example
This example is all about filtering an ArrayCollection in a DataGrid. We will filter the ArrayCollection using the input from the TextInput field, the value entered as the datagrid values are translated to lower case. The search is performed without position, this means that if I type ‘weaver’... Read more »
Viewstack Repeater Example
(preview)
Viewstack Repeater Example
The following example shows you how to use a repeater inside a viewstack. Our example about viewstack effects is very popular, and I recently found out how to use the repeater inside a viewstack, I decided to write an example about this subject. We are using a Linkbar, Viewstack and Repeater component... Read more »
Remove Folder and File icons from Flex Tree
(preview)Remove Folder and File icons from Flex Tree
The previous example with the custom open / closed icons had a nice result. It would be even nicer though, when the folder and file icons would dissapear. Luckily, this is also pretty easy to do in Flex, just add a style sheet to your application with the following css in it: 12345Tree{ ... Read more »
Change open and close icons on Flex Tree
(preview)Change open and close icons on Flex Tree
Personally I don’t like the default open / close icons (the down arrow / right arrow icons ) on the Tree control in Flex. Luckily, can can easy change them into a different icon. The Flex Tree has a number of properties you can style, what we are looking for here are the following two: disclosureOpenIcon... Read more »
Looping over an ArrayCollection with Cursor Example
(preview)
Looping over an ArrayCollection with Cursor Example
There are different ways to loop over an ArrayCollection, the two approaches that are used to most are (I think) the folling two: 12345// Assuming that I have a declared variable "ac" of type ArrayCollection which is not null for( var i:int=0; i<ac.length; i++ ) { //Do something... Read more »
Flex Custom Event Example
(preview)
Flex Custom Event Example
Events are a real powerful tool inside every programming language that has them. In actionscript, there are a lot of standard events that you are probably already using (e.g. the click event). But what if you want to do something custom with an event inside your flex application? Let’s say you... Read more »
Tree in Advanced DataGrid Example
(preview)
Tree in Advanced DataGrid Example
A Flex Builder Pro license adds some cool additional components to the standard collection. Examples are charts and the AdvancedDataGrid control, which i’m gonna use in this example. Adobe defines the AdvancedDataGrid as follows: The AdvancedDataGrid control expands on the functionality of the... Read more »
Style Flex Tree Label Example
(preview)
Style Flex Tree Label Example
One of the more complicated controls to work with in Flex is, in my humble opinion, the Tree. Ok, for displaying a simple hierarchy it’s simple and works just fine. But if you want to do some more complicated stuff with it, things get a bit tricky and some extra coding is necessary. For example,... Read more »
Flex Dynamic Chart Example
(preview)
Flex Dynamic Chart Example
Using charts in Flex is pretty straightforward and simple. But what if the number of chart items you’re about to show in your application is unknown (can be 1, can be 10, can be 15..) and you have to add them dynamically? I faced such a problem during a project I was working on, here’s how... Read more »
Ctrl+T or Ctrl+N in Flex
(preview)Ctrl+T or Ctrl+N in Flex
A while ago I had an issue. While I had some Flex application running in a browser tab, ctrl+t (open new tab) and (ctrl+n) were not working. I implemented a simple solution to solve this problem. Do the following: Add a keyDown event listener to your Application Implement the listener to do something... Read more »
Flex Timer Example
(preview)Flex Timer Example
Let’s say you want something to happen in your application every once in a while automatically. The Timer class is the way to do it. I was already familiar with the Timer class from C#, the Flex one isn’t all that different. Let’s create a simple exmple, just switching an image every... Read more »
Flex Effects Example in a ViewStack
(preview)
Flex Effects Example in a ViewStack
Since Adobe got a hold of Macromedia, they had Flash in their arsenal. And when you are using Flash, you have the ability to create cool, smooth animations. Using that technology, Adobe added a number of standard effects to Flex to make your applications look even better with smooth transitions using... Read more »
Image as Button in a DataGrid
(preview)Image as Button in a DataGrid
Just as the MouseWheel controlled slider idea, I had this idea when I was working on my flex MP3 player as well. I wanted to give the user the possibility to add tracks to a playlist by clicking a small plus icon in a DataGrid. There are a couple of things that have to be done to achieve this: Use an... Read more »
Control HSlider or VSlider with the Mouse Wheel
(preview)Control HSlider or VSlider with the Mouse Wheel
When I was working on my Flex MP3 player I thought it would be nice to make it possible to control the volume slider with the mouse wheel. I started scrolling trough the events of the HSlider component and luckily, there is a standard event that is dispatched when a user uses the mouse wheel. Using... Read more »
Simple Flex & PHP Example
(preview)Simple Flex & PHP Example
How do i get my data from Flex to PHP? I wondered about this a year or so ago when I was just getting to know Flex. I have to admit that my PHP skills are not that good, I can get things in and out of MySQL databases and that’s about it. But enough about me, let’s make a simple Flex application... Read more »
Using the Repeater in Flex
(preview)Using the Repeater in Flex
So you might come across some situation in which you want to repeat some part of your layout for each data item, but the number of items is unknown. Fortunately for us, Adobe provided a component with Flex which we can use to achieve just what we want: repeating parts of the layout for every item in... Read more »
ViewStack, LinkBar and ButtonBar Example
(preview)ViewStack, LinkBar and ButtonBar Example
When you are developing your Flex or AIR applications you’ll probably have one or more views where you want to put your components. Adobe Flex offers you multiple components to work with multiple views. Two examples are the TabNavigator and the ViewStack. I created a small example with the ViewStack... Read more »
Using A ComboBox in Flex
(preview)Using A ComboBox in Flex
The ComboBox or DropDown in other development environments, is a very useful input element. The great advantage of it is the fact that you can determine the values that a user can choose. The items that are choosable in a combo box can be both static as dynamic. The following examples show you how to... Read more »
Using the ProgressBar with a file download in Flex
(preview)Using the ProgressBar with a file download in Flex
So sometimes you’ll have time consuming procedures in your Flex application. Flex provides a nice moving clock thingy to let the user know that it’s doing something, but it doesn’t give the user any information about the progress. Fortunately, Adobe provided the ProgressBar with Flex.... Read more »
Images in DataGrid depending on data
(preview)Images in DataGrid depending on data
Flex DataGrids are usually used to give the user some overview of data. Sometimes we want to use a certain value in the data to describe something else (derive a value from the data). For example, we want to display if a product is in stock yes or no using the following data: 12345678910111213141516171819<?xml... Read more »








