[Updated] Regular Expression Tester v1.2

On January 11, 2008, Flash / Flex - 2 Comments

I’ve updated my regular expression tester, this version includes:

  • saving your regular expressions into a shared object;
  • setting the regular expression flags
  • some minor bugfixes
  • a bit more style added

update 15-01-2008:

Version 1.1 released:

  • the save function now also saves the string to match and the replace string

update 04-03-2008

Version 1.2 released:

  • New style, because the black style was giving problems with selecting text (black selection box on a black background, not good!)
  • Syntax highlight! When you hover over your expression you’ll see what the different parts of your expression mean!
    • When you click (to edit) the expression, highlighting is turned off, allowing you to make selections. To turn it back on click outside of the textfield and start hovering.

You can find it at http://www.idsklijnsma.nl/regexps/

An AIR version will follow soon!

Regular Expressions in AS3

On January 9, 2008, Flash / Flex - 2 Comments

For the past 2 hours I’ve been struggling with the regular expression engine of AS3. Normally, when I need to write an regexp, I test it in the Regular Expression Workbench, a .NET app which is quite handy. The problem however is that it uses the .NET syntax for regexes. Apparently, each programming language uses it’s own regular expression syntax. For example, in .NET you can create a named group using (?<groupname>), in AS3 you need to type (?P<groupname>). more…

Learn math with flash, flex or javascript!

On December 20, 2007, Flash / Flex - 1 Comment

Flex / Flash has a neat feature: doing math for you.

So when you want to know what 0.1 + 0.2 is, you don’t need your calculator, just use flex. The result: 0.30000000000000004.

WTF is that about?

I’m currently trying to find out a fix for this. ATM the only workaround is doing a

?View Code ACTIONSCRIPT
var x:Number = 0.1 + 0.2
Math.round(x*10) / 10

How hard is it to add to two numbers and give the correct result?

or of course

?View Code ACTIONSCRIPT
var x:Number = (0.1 + 0.2).toFixed(1)

Works for actionscript as well as JavaScript

By the way, it’s not only 0.3 which is causing problems. more…

[Flex] One labelfunction for multiple datagridcolumns

On March 27, 2007, Flash / Flex - 2 Comments

The labelfunction of a listbased component is nice, but a bit limited.
For instance, you have to specify the (data)fieldname inside the function, which makes it impossible to use it for other columns. Wouldn’t it be nice if you could write one labelfunction for all your columns? I thought it would.

In order to accomplish this, I needed to have the columndata inside the labelFunction. At first, I was thinking of extending the labelFunction, but that wouldn’t help me much, because Flex was still sending only the original data and not the columndata. So I went deeper in the component, searching for the function responsible for calling the labelFunction.

more…

[Flex] Custom treeicons without embedding them

On , Flash / Flex - 11 Comments

Sometime ago a wanted a tree with all different kinds of icons, depending on the type of the branch. Flex has some support for this, but only for embedded images. The problem was that I couldn’t use embedded images because the images are loaded dynamically from a database. So I had to find a way to fool flex, and the solution is quite simple. more…

[Flex / CSS] DateField / DateChoosers….

On March 7, 2007, Flash / Flex - 1 Comment

I’m currently working on skinning an Flex Application, and I ran in some strange CSS behavior. When you skin a datechooser component and set some styles with CSS like this:

DateChooser{
	rollOverIndicatorSkin: Embed(source="/assets/skin/flex_skins2.swf", symbol="DateChooser_rollOverIndicatorSkin");
	selectionIndicatorSkin: Embed(source="/assets/skin/flex_skins2.swf", symbol="DateChooser_selectionIndicatorSkin");
	headerColors: #333333, #000000;
   	backgroundColor: #474747;
   	color: #a7a7a7;
   	headerStyleName: "mydateChooserHeaderStyle";
}
 
.mydateChooserHeaderStyle {
   color: #a7a7a7;
}

and insert a datefield, not all styles are applied to the build-in datechooser of the datefield (for instance, the background-color, it just stays white).

The solution to this problem is to use the date-chooser-style-name property of the datefield. You then can specify a classname for the datechooser. The problem with this solution is that you get two classes, specifying the same component.

But then I thought wait… It’s CSS right? So I can specify styles for multiple classes or containers, like this:

DateChooser, .date-chooser{
	/* code here */
}
 
DateField{
	date-chooser-style-name: "date-chooser";
}

[Flex] Really disable disabled items

On February 15, 2007, Flash / Flex - No Comments

I recently discoverd another bug in Flex 2.0.1 / ActionScript 3.0. You cannot trust the enabled property of some components. Especially listbased components like datagrids. When you set the enabled property of a datagrid to false, it still responses to doubleclicks and happily fires it’s events. Probably not what you want. The solution is fairly simple though:

<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"  >
	<mx:DataGrid
		id="contentitemGrid"
		doubleClickEnabled="true"
		mouseChildren="{contentitemGrid.enabled}" />
</mx:Canvas>

By disabling it’s mouseChildren property, the clickevents of the datagrids children (the items) aren’t fired anymore, so the doubleclick is ignored.