Archive

Posts Tagged ‘Flex’

Hide or remove the header of a Flex Mobile View

June 9th, 2011 Wannes No comments

When you have a mobile Flex application, your views will automatically have a header. This header is called an actionbar.
When you want to hide or remove this header on some views, you need to set the property actionBarVisible on false.

<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark"
        actionBarVisible="false">

You could also use the ViewNavigator.hideActionBar() method to hide the actionbar for all views controlled by the ViewNavigator.

protected function creationCompleteHandler(event:FlexEvent):void {
            navigator.hideActionBar();
}

This is related to:
- Flex mobile remove title
- Flex view hide header
- Flex view hide or remove actionbar

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 2 comments

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…

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: ,