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.
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 »
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 »
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 »
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.
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.
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 »
Yes, thats right. I have just released some updates to Coldfusiondocs.com. It’s now got a 4th panel to it which lists the related links for the tag or function in question. The idea here is that, lets say you are browsing cfquery tag on the left panel, you should be able to look at the cfquery related links (ideally blog posts or other useful links specific to cfquery), right there on the right panel.
I think this adds more value to it in a way that you can look at the documentation and the “interesting” blog posts at the same time in the same interface. It would be really helpful to have these links “rated” and the most rated ones show on top but I would leave it like this for few weeks and based on the interest it generates, I would then later on add the rating feature. Remember, this is not a paid project, so I have to keep this development only to my limited free time.
At the moment, anyone can add links by entering a name and email address, and apart from some very basic validations, its straight forward to add a link. You just need to select a tag or function on the left panel (I have added a few in cfgrid to start with), and then on the right lower panel, fill the form in to add links. Thats about it.
There is no moderation at the moment but I will periodically do an exercise to remove any “non-genuine” links (not that I expect them but you never now), until I put some checks in place to validate a link (as in if it really is a CF related link).
So, go ahead and add links. www.coldfusiondocs.com/app/
If you want to display a hand cursor over a Flex component (any Flex Component I would say ?), there are two properties that come handy. useHandCursor and buttonMode. In some cases, a third property called mouseChildren might be required as well.
More »
I am a bit late in blogging about this as the news is all over the blogospher by now but its Monday morning and I just found this out.
Adobe have released Flex 3.0 and AIR 1.0 . This was a much awaited news as far as I know. The good thing is that they have setup a Adobe Open Source Flex SDK wiki which looks good as well.
And because the SDK is open source, the code can be downloaded via SVN from here.
http://opensource.adobe.com/svn/opensource/flex/sdk
Thanks to Adobe for all this and I am very excited about working with Flex/AIR and building RIA apps that look and work great at the same time.