Archives for categorie "Utilities"

For Eclipse to regcognize projects with Flex nature you need to edit .project file and make sure that the flex natures are the first in the list:

<natures>
	<nature>com.adobe.flexbuilder.project.flexnature</nature>
	<nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
	<nature>org.eclipse.jdt.core.javanature</nature>
	<nature>org.maven.ide.eclipse.maven2Nature</nature>
	<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
	<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
</natures>
  • Share/Bookmark

Remove zeros function from left side of a number.

private function removeLeftZero(value:String):String {
	var pattern:RegExp = /^0*/;
	return value.replace(pattern,'');
}
  • Share/Bookmark

Sometimes objects in a Flex DataGrid are more complex and we need to show other property level. There is an example of a renderer that allow to point the property to show and its level in the object.

private var items:ArrayCollection = new ArrayCollection ([
{
	name:'Name 1',
	level: {
		level1:{label:'Level 1-1', value:101},
		level1:{label:'Level 1-2', value:201}
	}
},
{
	name:'Name 2',
	level: {
		level1:{label:'Level 2-1', value:102},
		level1:{label:'Level 2-2', value:202}
	}
}
]);

[...]
<mx:DataGridColumn dataField="level.level1.label" headerText="Level"/>

Source codeClick with the right button to obtain source code.

  • Share/Bookmark

Static variables of a class can be initialized automatically with a snip code within package between curly brackets as following:

package com.arcadio
{
    [Bindable]
    public class MyClass
    {
            public static var myText:String="Hello";
            public function MyClass()
            {

            }
    }
    {
    MyClass.myText="Bye";
    }
}

¡Thanks Alfonso by your note!

  • Share/Bookmark

Weakness of a encryption data system (between Flex and Java) is based on capturing the key it used to cipher. It’s possible to generate the key dynamically to get extra security level.

System is described with following picture:


Source codeClick with the right button to obtain source code.

  • Share/Bookmark
Creative Commons License
This blog is under Creative Commons licence, unless indicated otherwise.
Special thanks to Mark James for the icon set used in this blog.