In the previous article I came out with a function that calculates the position of the cursor in the htmlText which is different than the position in the normal text. Rick draw my attention in his comments to some flaws which are correct: the & and other similar special chars are not counted correctly and [...]
Last task I finished was something linked with templates. I needed to create a simple template engine where adding a field was a necessity. I started using RichTextEditor which is based on a TextArea so it implements htmlText property. That is an easy way having all that nice functionalities like bold, italic, font choosing, color [...]
This post is about how to remove duplicate characters from a string. And what I mean is that I want to make every char unique.
Ex: “aabbbcccaadddee” will become “abcde“.
In “short words” the following steps are taken:
Split the string to an array (source array)
Create a second empty array which will retain the unique values
Sort the [...]
Big RIAs need good interaction with the user. In big applications (like Buzzword, etc) with intensive text processing is a must to have implemented a spell checker.
A very good spell checker that is built in Actionscript 3 is Spelling Plus Library (SPL) by gSkinner - the license is here and can be bought from here.
It [...]
When speaking about RIA one of many nice usabilities is that to be able to give feedback to the user when it comes to critical actions like submitting important data, saving work, etc. Let’s have the following example: You log in into a RIA with your user and password, you do changes to your data [...]
If you have a label and you want to show a hand cursor when the mouse is over it you have to set three properties as bellow:
lbl.useHandCursor = true;
lbl.mouseChildren = false;
lbl.buttonMode = true;
where lbl is
public var lbl:Label = new Label();
Job’s done!
Today I found a way to remove the “black line” of a tree which has drag and drop functionality enabled. I did that by skinning. Searching through the help I’ve been crossing over a property named “dropIndicatorSkin” where (as its name is suggesting) the drop line is drawn. So I just re-skinned it.
Here is the [...]
Two days ago I needed to customize the very first preloader of a flex application (the one that is shown before finishing loading initialization classes of flex). My first impression was that it cannot be changed because I thought is something built in the Flash Player but at the end I found a way using [...]
One thing, among others, that Flex doesn’t have, and is important because many of its components needs XML structures, is deleting (taking out) nodes from a XML structure. This is crucial for a tree or for a menu where you need to change it dynamically. So bellow is a recursive method that will go through [...]
I don’t know if you got in trouble when working with xmls but recently I found a bug (or a feature). Some differences when using toString() and/or xmlToString().
Take a look a the following code:
public var test1:XML = new XML("
<permissions></permissions>
");
public var test2:XML =
<permissions></permissions>;
public var test3:XML = new XML("
<permissions>
<test1>test</test1>
</permissions>");
public var test4:XML =
<permissions>
[...]
The following code inverts the colors of an image and returns the inverted image as an Image object. As parameter it needs the container of the image (a canvas).
private function invertImageColor(canvas:Canvas):Image
{
var newImage:Image = new Image();
newImage.source = Image(
[...]
I was working to a flex project and I just need to make a cast to a value to int … this it’s simple … and not so.
After few hour later, I have a vision …
I just try to make a cost from a decimal value to int, and I have noticed that depends [...]
As I have played with RSLs more I saw something surprising: If I compile the swc into a swf the resulting swf is bigger (almost twice) as it should have been. When you use compc to create a SWC, the SWF inside the SWC contains a lot of unnecessary stuff when used as [...]
As you saw in the previous posts you can use RSLs to reduce the size of a flex application.
If you use mxml in your application you should know that behind the scenes Flex will include in the project a lot of classes and controls (some of them you do not even want). You [...]
In a previous article I told you about the benefits of RSL’s. But you need also to know how to create them from a swc and how to use them.
First step is to create a new “Flex Library Project”. Write all the code you want to have in it. Then in your main application [...]