Sunday, October 3, 2010

How to create Flex button with pulsing effects?

You can create simple Flex button using MXML tag or actionscript but many times you need more on real world project. You can assign some kind of animation or pulsing background to normal Flex button. But to do that you have to create the effects in Flash. Now you have to import that into Flex but do that you need to do the following

1. First create Animation.swf Flash file. It has effects you want to assign to Flex button.

2. Animation.swf contains symbol name. Now you create simple actionscript class call Assets.as


public class Assets{

[Embed(source='assets/animations/Animation.swf#square')]
public static var animation_icon:Class;

}

3. Make sure you have "square" symbol or any other name symbol in Flash file. That symbol will have animation or effects you want to assign to flex button.

4. Now in your Flex or actionscript code where you have created button assign the effects like this

button.setStyle("icon",Assets.animation_icon);

5. You can remove the effects using following
button.styleName = (any normal button style you want to see);


Now you can see the animation or effects in Flex button.

Enjoy.

Monday, August 30, 2010

Do you need additional framework for Flex 3 or 4 development?

I am of strong opinion that you don't need any additional framework for Flex 3 or 4 development. If you follow codebehind in Flex development with custom event handling solve lot problems you try to handle with additional framework (e.g. famous PureMVC & Cairngorm)

more later..

Friday, July 16, 2010

Flex Builder internal error - Right click to find more information

If your project compile perfectly fine one day and next day you get "Flex builder internal error: Right click to find more information" check out following link from Adobe.

Adobe Link for error


Basically chances are very high you might have added new file or changes where you have blank switch statement.

switch(case){

}


You can remove it or add default and project will compile again. Small things but makes life tougher sometime.

Enjoy.

Friday, July 9, 2010

Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found

If you see the above error don't waste much time but debug your application from start point i.e. s:Application (flex 4) or mx:Application (flex 3) and see if you have any custom preloader. If you have provided wrong url it will fail.

Otherwise make sure your images are in right path basically it is URLRequest (url--> problem)..

Enjoy

Sunday, June 20, 2010

Never apply CSS while to textarea using styleSheet property

var myCSS:StyleSheet = new StyleSheet();
TextArea.styleSheet=myCSS;


Instead of attach to TextArea add CSS related code to HTML code.

i.e.

TextArea.htmlText("html tag with css class just like your normal HTML")

will work in all type of browser and scenario where you are fetching RSS feed into TextArea (which will get reloaded every time you have new feed)


Enjoy.

Sunday, May 30, 2010

FocusManager getIndexOfNextObject in Flex Application

mx.managers::FocusManager/getIndexOfNextObject

Error means FocusManager is looking for mxml component to set focus, when hit tab from flash object and fun part you don't have any mxml component to set focus.

Here is the trick create mx.button component and setStyle to null. It will invisible and focus manager can find the component to focus. Now application won't crash or hung.

myButton.setStyle('skin', null);

(mx:Button skin='{null}' )

.myButtonStyle {
skin: ClassReference(null);
}

(mx:Button id="myButton" styleName='myButtonStyle')

Enjoy.

Friday, May 21, 2010

Dynamically resize nested Flex List with variableRowHeight

I was stuck recently with a Flex component that had a List with an itemRenderer. The itemRenderer contained another List with an itemRenderer. Now the problem with this is that the data had unique counts and the lists had variable row heights (variableRowHeight = true). The result was that containers would not dynamically resize enough to display the whole List. In other words, the List was clipped and vertical scroll bars were displayed.

Sounds familiar to me when I had same problem as above developing comment component. I found solution in following blog

1. Link to the reference blog


2. You can also visit another blog post with good example for same problem

Bryan Bartow


Hope that helps.