MultiLine Label in Flex

Tagged Under :

If you are a Flex developer, you would have come across this issue several times. If you are using the <mx:Label> control and the size of your text is bigger than the size of the container, you will see a cut off version of the text because by default, the Label control does not allow multiline text.

So, here is what I wrote quickly to achieve this functionality.


package components
{
 import mx.core.UITextField;
 import flash.text.TextFieldAutoSize;
 import mx.controls.Label;
 import flash.display.DisplayObject;

 public class MultiLineLabel extends Label
 {

 override protected function createChildren() : void
 {
 // Create a UITextField to display the label.
 if (!textField)
 {
 textField = new UITextField();
 textField.styleName = this;
 addChild(DisplayObject(textField));
 }
 super.createChildren();
 textField.multiline = true;
 textField.wordWrap = true;
 textField.autoSize = TextFieldAutoSize.LEFT;
 }
 }
}

The code overrides the createChildren() method and creates a new instance of UITextField which has multiline and wordwrap turned on.

Flex Vertical TabBar With CornerRadius on Left or Right

Tagged Under :

If you are using Flex and want to have a TabBar control that aligns vertically instead of the default “horizontal” behaviour , then you can simply use the “direction” property on the control and make it vertical. You can see an example of that below . Notice how the tabs are now vertically aligned but the borders are still on top, left and right. And see how the cornerradius is still on the top left and top right corners. More »

Triggering FlexSpy with a Keyboard Shortcut

Tagged Under : ,

If you are a Flex developer, you are probably aware of what FlexSpy is. FlexSpy is an inspection tool for Flex applications, similar to what Firebug is for HTML applications. FlexSpy is distributed as a .swc file (Flex Library file) which you can simply put under your projects’ “libs” folder and it will become available to use in your project. Once you trigger FlexSpy , you can inspect and change the properties and styles of the visual components in your Flex application. Pretty useful tool, makes life very easy for a developer. More »

Flex: Casting with AS vs Casting with Braces

Tagged Under :

I gave a telephonic interview yesterday (yes, I am looking for new contract roles these days!) and this question came up. The interviewer asked the difference between Casting with Braces and Casting with the “AS” operator in Flex. I thought I could write a little example to demonstrate the difference between the two. More »

ColdFusionDocs now using Cairngorm

Tagged Under : , ,

This weekend, I thought of revisiting the Coldfusiondocs.com application which I didn’t get the time to even touch for last so many months. I thought using Cairngorm to re-write the app would be ideal as it’s the most widely used Flex framework around.

So, I went ahead and re-wrote the whole thing using Cairngorm (took me one full day) and in the process optimized/fixed the existing minor problems as well. And I also thought that, since this is a project for the community, why not release the code to the community as well. So, for those who are interested, here is the Project with the source code. And yes, project contributors are most welcome. There is loads we can do with it.

A note for those code critics : I am not a Flex guru and definitely not a Cairngorm guru. So, please keep the code critics to be postive ones please. This doesn’t mean my code is bad, it just means it “might” not be the best code around. Also remember, this is not a paid project anyways.

Flex: Passing Data with Custom Events

Tagged Under :

A reader asked me a question based on my earlier post about how to maintain Login information in Flex and how to pass data along with Custom Events.

So, I decided to write up this post. I have written a simple example which does the following :-

1) Display a Login form with Username/Password fields.
2) Calls a AuthService for authentication on Click of the Login Button.
3) The AuthService fires a Custom Event if login successful and sends across the user details along.
4) The Main Page listens to the Event and sets the User details in a Static class for use anywhere in the Flex app.
5) The page changes its state when user is logged in.

The View Source is enabled on the example so feel free to look at or download the code. I hope this example helps answer the question here.

Flex Frameworks

Tagged Under :

I think frameworks are always a debatable topic, no matter which programming language you talk about. I personally am not even sure whether using a framework in every project you do, is such a good idea or not. But anyways, thats a separate topic. I just think that you should atleast know about the capabilities and usefulness of frameworks so if you have to use them, you should be able to. More »

Railo Support Added to coldfusiondocs.com

Tagged Under : , ,

I have just released an update to coldfusiondocs.com . As the title says, I have added Railo support to the documentation, so now you get a new tab for Railo tags and functions and just like before, you can search and view the documentation.

I think it makes sense to add this as part of the documentaiton. As always, any feedback is more than welcome.

More updates to coldfusiondocs.com

Tagged Under :

Last night, I made some more updates to ColdFusiondocs.com, although minor updates again. I have changed the right panel to have a tabbed layout rather than a top and bottom layout, I think this gives more room for the actual content and both the documentation section and the useful url’s section should be easier for the eye.

Another minor change I did was to focus the search field on load and place the text caret in there. I cant seem to get it to work in Firefox though, would be nice to know if anyone has a fix.

On a side note, I am still struggling to get the deep linking to work mainly because of the fact that the way this app is written. I wil try some more when I get some time as I know its an important feature for this app.

Oh, by the way, as a reminder, you are more than welcome to go and add you CF related links to the app.

Here is the link. www.coldfusiondocs.com/app/

YouTube Videos in AIR with FLVPlayer

Tagged Under :

One of my mates just sent this through to me, so I thought this is definitely worth a post :-

The FLVPlayer is a non-commercial, conceptual AIR application, intended to simplify the video transfers from YouTube to computers and mobile devices like IPhone, IPod, smartphones.

It provides the functionality to download videos onto PC, MAC or Linux and transfer them to the device later on, so the device’s bandwidth is not used later to stream videos. Other useful functionality, is a video playback. It has been built with Adobe AIR and Papervision3D. The application can be installed on PC/MAC/Linux machines, by using the image link below: