The goal here is to use a TextArea component to display some text that doesn’t quite fit in the specified region and ellipsis points (…) should be showed to let user know the text is trimmed. Standard stuff right ? But Flex doesn’t do it by itself and I thought someone might look for this.
My problem was with a Flex app that uses i18n and in some languages the text didn’t fit the box, the scroll bar policy was off and user had no idea there was more text in there and didn’t had the possibility to scroll further. Anyway, here it is :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
| <mx :Script>
< ![CDATA[
[Bindable]
private var text : String = 'The quick brown fox jumped over the lazy dog. ' +
'The quick brown fox jumped over the lazy dog. ' +
'The quick brown fox jumped over the lazy dog. ' +
'The quick brown fox jumped over the lazy dog. ' +
'The quick brown fox jumped over the lazy dog. ';
private function trim(text : String) : String
{
box.text = text;
box.validateNow();
if(box.maxVerticalScrollPosition > 0) {
text = text.replace("...", "");
text = text.substr(0, text.length - 1) + "...";
} else {
return text
}
return trim(text);
}
]]>
</mx>
<mx :TextArea id="box"
verticalScrollPolicy="off"
width="250"
height="50"
wordWrap="true"
text="{trim(this.text)}"
paddingBottom="0"
editable="false" /> |

Flex / ActionScript ellipsis, flex, points, recursion, textarea
If you have a problem with quotes in Windows 7, try to switch the keyboard layout from “United States – International” to “US”
After installing Windows 7, I discovered the following behavior in the code editor: Pressing the quote (‘) or double-quote (“) key once would have no effect. Pressing any key after that would produce both the double quote character and the next character.
The problem is caused but by regional settings – I solved it by switching from “United States – International” to “US” keyboard layout.
Go to Control Panel->Region and Language->Keyboards and Languages tab->click Change keyboards… where you add English (United States) – Us to the list and then select it as default from the top drop down list.
Stuff how-to, quotes, windows7
Our Transylvania Flex Group 3th event will be held this Saturday (November 21, 2009) in Cluj-Napoca.
This one will be a showdown between RIA technologies, with advocates from our Betfair Office. Iosif George for Flex, Vlad Nemes for AJAX and Silviu Niculita from RIASolutionsGroup for Silvelight.
Registration is free and you can signup for the event here. See you there !

Misc ajax, event, flex, silverlight, transylvania, usergroup
I just finished writing a Flex3 library that will allow you to read a great number of image formats using flex and actionscript 3. The component uses a codec like rendering system, so each time you provide it with a source, the codecs attempt one by one to read the file signature and decide which one is fit to decode the image.
So doing this, it won’t matter the file extension or the way you provide the image asset (archived, link, base64 encoded, plain text, byteArray or embedded at compile time)
It’s a work in progress but curently I’ve made codecs for the following formats:
- PointLineCAD 3D objects (*.p3d)
- Photoshop images (*.psd, *.pdd)
- ZSoft images (*.pcx)
- Truevision TGA (*.tga, *. icb, *.vda, *.vst, *.win)
- Windows icon files (*.ico)
- GIF images (*.gif – static and animated gifs)
- JPEG images (*.jpg. *.jpeg, *.gfif)
- PNG (Portable network graphic) images (*.png)
- Windows Bitmap images ( *.bmp, *.rle, *.dib)
- Adobe Shockwave Flash (*.swf)
As I said before, the way you provide the source doesn’t really matter. You can zip up all your images in an archive and as source you can just point to the file inside the zip.
1
| <adm :ExtendedImage id="img" source="archive.zip://image.png" /> |
This way, you greatly reduce the number of requests to the server. But this is not all. Source can be also provided as a base64 encoded string, or as plain text (only p3d can take advantage of this since the p3d file is plain text as well).
For a bit more details, a demo and API description, visit this page
Flex / ActionScript, Programming actionscript, as3, component, flex, library
Typography is one area of web development that has seen painfully little advancement when compared with other areas of the industry. Web developers have been forced to rely on a small set of ‘web safe’ fonts that are likely to be installed on the majority of their visitor’s computers. Image and flash-based solutions have arisen, both of which have downsides to using.
Cufon offers developers a robust and fast solution, which can be displayed in the browser without requiring third-party plugins using features built in to browsers. Cufon fonts can be used as VML for native IE implementation, or the
Usage
This library differs from the others in that a little bit of preparation is required before use; a new font file needs to be generated which can be done easily using the cufon website. The will generate an SVG font and save it in a JS file. This file needs to then be linked to any other <script> resource after the cufon core file:
1
2
| <script src="cufon.js" type="text/javascript"></script>
<script src="Breip_500.font.js" type="text/javascript"></script> |
Then it’s just a case of telling Cufon which elements to replace:
1
2
3
| <script type="text/javascript">
Cufon.replace('h1.replacedFont');
</script> |
The API offers other solutions for using multiple fonts on the same page and for improving performance in IE. Although I’ve called this section, “Using any Font”… you should remember that only fonts that are licensed to be embedded should be used. The following screenshot shows a replaced heading:

[Download] [Demo]
Java Script, Programming embeded, font, html, javascript