Category Archives: Flex

Array shuffling in ActionScript3

Been wanting to add this post for a while. Pretty simple, really. So imagine you have an array: It can be any size, obviously. And you want to change the position of its items. Several ways to do so – like splicing the array, but i dont recommend it because theres a loss in speed… Read More »

AMFPHP 1.9 problem with PHP 5.4

I was developing an application at work that used amfphp 1.9. All was working until i decided to bring it home to work over the weekend (thats already a bad thing to do right there), and i started getting errors. At work i use windows 7+xampp (with php 5.3.8), at home i use windows 8+xampp… Read More »

Iterating through a Dictionary

Keeping things simple for anybody who does a search about this subject: If we have a dictionary like this: var dictio:Dictionary = new Dictionary(); dictio[“france”]=”paris”; dictio[“england”]=”london”; you can iterate like this: Iterating through the keys: for(var country:String in dictio){ trace(country); // this lists england, france } Iterating through the values: for each(var capital:String in dictio){… Read More »

Sort an ArrayCollection

If you have an ArrayCollection and need to sort it, heres a quick example: import mx.collections.ISort; import mx.collections.ISortField; var sort:ISort = new Sort(); var sortfieldNome:ISortField = new SortField(“name”,true); // “name” is a field on the arraycollection var sortfieldEmail:ISortField = new SortField(“email”,true); // “email” is another field on the arraycollection sort.fields = [sortfieldNome, sortfieldEmail]; myArrayCollection.sort =… Read More »

Copy ArrayCollection – not as a reference

On my day job, i needed to copy an ArrayCollection to a different var so i could manipulate it without affecting the original. Went with this: arraycollection2 = arraycollection1; With this method, all i did to arraycollection2 was also happening to arraycollection1. to copy arrayCollection1 to arrayCollection2 without making it a reference: arrayCollection2 = ObjectUtil.copy(arrayCollection1)… Read More »

FlashBuilder 4.x Color Scheme/Theme

Spending a lot of time in front of my monitor looking at code on a white background was slowly getting on my nerves. I looked up on changing the flash builder IDE color scheme and came up with some nice alternatives. My life coding life just got much nicer…and darker. This is tested on Flash… Read More »

How to add a line break in a flex TextArea

To add a line break inside the text of a TextArea component in flex we cannot use \n, but instead use ‘&#13;’ (without the quotes). For example: <s:TextArea text=”this text will be on the first line&#13;and this one on the second” …/> will produce a text box with this text: this text will be on… Read More »

Adapt Flex Datagrid height to content

This is a fix for a recurring problem. When we want to make the datagrid’s height to cover its content (dataprovider). <mx:DataGrid xmlns:mx=”http://www.adobe.com/2006/mxml” variableRowHeight=”true” verticalScrollPolicy=”off” wordWrap=”true” rowCount=”{dataProvider.length}” dataChange=”resize()” columnStretch=”resize()” resize=”resize()” > <mx:Script> <![CDATA[ //This is a work around for the poorly designed wordWrap and variableRowHeight features of the DataGrid private function resize():void { if (dataProvider)… Read More »

Air project doesn’t run. No error.

Didn’t quite know what to use as a title, because the problem sounds a bit too generic. Anyway, on to the problem/solution. The problem was that i was trying to convert an already built/in progress Flex project to Air and it was giving me some grief, since it simply didnt run. No error, nothing. The… Read More »

Format/convert decimal to hexadecimal (or other numeral system)

My problem was to convert some calculations from decimal to hexadecimal to be used in a canvas background color. Specifically, convert from CMYK, from a pantone list, to RGB and apply the result to a canvas. In a different post i will describe the convertion, might be useful for someone. Flex has a way of… Read More »