Listen to every mouse click in your Flex application

June 8th, 2010 Wannes No comments

Sometimes you need to know when there is a mouse click in your Flex application.
Instead of listen to all the components you just can add the next listener:

systemManager.getSandboxRoot().addEventListener(MouseEvent.CLICK, onApplicationMouseClick);

private function onApplicationMouseClick(event:MouseEvent):void
{
     //your code
}

Note: When the user prevents the default behaviour (event.preventDefault) of a mouse click event, the code above will not be triggered.

Add a line or stroke to a Spark skin

June 3rd, 2010 Wannes No comments

This is how you add a line to your Flex Spark skin without using a Rectangle (Rect) its strokes.

In this case a horizontal line will be drawn on the bottom of your skin.

<s:Line left="0"
        right="0"
        bottom="1">
    <s:stroke>
        <s:SolidColorStroke color="0xFAFAFA"
                            weight="1"/>
    </s:stroke>
</s:Line>
Categories: Flex, Spark Tags: , , ,

Provide a Flex itemEditor with dynamic data

June 2nd, 2010 Wannes 1 comment

When your Flex application needs an editable datagrid, you mostly add some itemEditors or itemRenderers to change the data.
You can find a lot of samples on the web, although it is not always that easy as most of them show.

This post shows a solution when you need an itemEditor that needs data different from the itemEditor its data property.

You can see an example of this blog post behind this link.

Read more…

Categories: Flex Tags: , , ,

A Flex issue with an editable datagrid its itemEditEnd event

May 28th, 2010 Wannes No comments

Today I had to create an editable datagrid in my Flex application. Once a property of a row was edited, the edited item must be saved to the database.
I didn’t expect much trouble, although I get stuck with a really annoying Flex issue.

I added a listener to the dataGrid its itemEditEnd event, so I could save the item in the listener function.
For some reason, the item its property was not yet changed when the event was dispatched.
I looked for some relevant event properties, but nothing useful found.

After a while I solved it by adding a callLater in the listener. A timeOut or a callLater is not my favorite way of working, but I didn’t found a better solution.

I uploaded a sample.

Please feel free to add a better solution!

Categories: Flex Tags: , , ,

Firefox 3.6 adds scrollbars to a fullscreen Flex or Flash application

March 23rd, 2010 Wannes 2 comments

After updating to Firefox 3.6, my Flex applications received unwanted scrollbars after clicking (activating) them.
Firefox 3.6 will draw a 1 pixel ‘focus’ border around the Flash player.
To avoid this issue, just add the following css to your index.template.html.

a:focus, object:focus { outline: none; -moz-outline-style: none;  }

For more information : http://www.flashcomguru.com/index.cfm/2010/3/22/prevent-swf-border-firefox

Categories: Firefox, Flex Tags: , , ,

Prevent the drag possibility for some items in a dragEnabled Flex list

January 21st, 2010 Wannes No comments

If you have a Flex list (List, DataGrid, TileList or whatever) that is drag enabled, you don’t always want that each item of the list is draggable.
It should be very handy if Flex offers some kind of filter function that decides which items are draggable and which aren’t. Unfortunately such a function is not available yet.

The easiest way to prevent the dragging at this time is to listen to the dragStart event and prevent the default behavior when the item is not allowed to be dragged.

Read more…

Update a datetime field by adding extra time in MySql

January 14th, 2010 Wannes No comments

If you want to update a datetime field in a mysql table by adding some extra hours for example you can use the next statement:

UPDATE table_name SET column_name = ADDTIME(column_name, '9:0:0')

This will add 9 hours to each row of the table. Read more…

Categories: MySql Tags: , ,

Mail your group members in Syncerd

December 4th, 2009 Wannes No comments

From now on it is possible to e-mail your team members in Syncerd.
Just click the e-mail button and you can select the group you want to send an e-mail.
If you want to be more specific, you can select an activity and filter the recipients on status.

Enjoy!

Categories: Syncerd Tags: ,

Prevent row selection in a list or datagrid when an itemrenderer has been clicked

December 4th, 2009 Wannes No comments

When your list or datagridColumn has an itemRenderer with a component that can be clicked, you don’t always want to select the row in your list.
To prevent the selection, you need to listen to the mouseDown event and stop the propagation (event.stopPropagation()). Read more…

Categories: Flex Tags: , ,

Enable double click interaction on a UIComponent in Flex

December 4th, 2009 Wannes No comments

If you want to interact on the double click event on a UIComponent, you need to enable the “doubleClickEnabled” property. Read more…

Categories: Flex Tags: ,