Disable Flex App on TimeOut.

February 29, 2008

First define a Timer with the specified timeinterval.

var mTimer:Timer=new Timer(3000);  –> here 3 secs.

Now add eventlisteners as Timercomplete.


start the Timer.At a needed location.


Now define the function as called from the EventListeners.[i.e Comple].

private function Comple(e:TimerEvent):void
//Disable the app with the line of code below.

this.enabled = false;


This will Disable the App after 3 secs.

There is a clear post on use of Timer below this post, read it to know the basics of the Timer.

Enjoy the code !. The below snashot is the disabled Flex app.

Disabled Flex App.

Flex is really Flexible !

February 25, 2008

There are so many features in Flex that even i didn’t know it for a long time.And when i discovered them i felt like “What the F*&K is this”!.[ Dont mind]

[This [my] views are based on the Flex 3: beta 3.]

My boss told me to install Flex 3 :beta3 and work on it and i did so , after installation i started moving around the different views  in Flex prespective, they are just amazing.

First thing i found there is the DataBase connectivity, i can create a JDBC connection  [others are also available] and access my DB,isn’t that cool, there are many features in it also.

I will make a described post on this later.

Next thing i found is the Flex Profiling : i was really amazed this time.The people who had made this are really genious ,i mean “ex”.

I will make a clear picture and post it here ,so that i can be usefull for other flex lovers.

And i think these are known by few Flex developers!.Just my opinion.

And what not, have to discover new things ,so what r u waiting for get Discovered!.

Using StringValidators in Flex.

February 21, 2008

packages to import:

import mx.events.ValidationResultEvent;
import mx.validators.Validator;
import mx.validators.StringValidator;

mxml Tag to use:

<mx:StringValidator id=”strVal” property=”text” />

on what control:

<mx:TextInput x=”256″ y=”10″ id=”txtuname” width=”206″ tabIndex=”1″/> 

ActionScript code to use:

strVal.requiredFieldError=”Enter Your User Name”;
var bill_result1:ValidationResultEvent=strVal.validate();

Hope you understand the code.Enjoy the code.

Applying styles to Date Field Control in Flex.

February 14, 2008

Here we got to use a property to apply style to our Date Field control.

dateChooserStyleName                   -> property to use

use it as:

<mx:DateField id=”dateField”
dateChooserStyleName=”subDateChooser” />

Now define ur style like below with properties of your like.

.subDateChooser {
backgroundColor: black;
color: white;

Now the Date Field control has the style we have defined.Date Field Styles.

This gives the snapshot,enjoy the code.

Using Timer Class in Flex.

February 13, 2008

Using Timer Class we can raise an Event at specified Time and even at the completion of the specified Time.

The below example uses two events, one if fired for every sec and other one after the completion of the Time specified.First define a var of type Timer with time specified ,which specifies the time interval you wanted to raise the event.

var mTimer:Timer=new Timer(1000,5);//ticks for 5 sec’s

Then add events to it for every sec and completion of specified time like below.


Now start time.


Define the two function you wanted to call for events.like below.

private function Countsec(e:TimerEvent):void
private function Comple(e:TimerEvent):void
lbltime.text=”Time Complete”;

Here lblTime is the Label Control id in Flex.

<mx:Label id=”lbltime” x=”374″ y=”167″ width=”369″ height=”61″ fontWeight=”bold” fontSize=”30″/>

Thats all the Time is set for 5 sec, Enjoy the code. 

Refresh/Reload Flex App using JavaScript code.

February 12, 2008

When you search to accomplish a task in Flex and can’t do it, then look for it in JavaScript because many of things that are not possible in Flex are possible using JavaScript which is the backbone of your Flex App.

I had a requirement were i wanted to refresh/reload the Flex App ,but i couldn’t do it in Flex and finally i realized that it may be possible using JavaScript then i went for it and coded, “WOW” i said to my self because it worked ,my App got reloaded/refreshed.

Then decided to post it in Blog, because it may help out other Flex lovers.

Code Example:

<?xml version=”1.0″ encoding=”utf-8″?>
<mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml&#8221; layout=”absolute”>
<mx:Button x=”83″ y=”196″ label=”Button” click=”reloadpage(event)”/>
private function reloadpage(event:MouseEvent):void
var ref:URLRequest = new URLRequest("javascript:location.reload(true)");
navigateToURL(ref, "_self");

Here on click of Button the App is reloaded/refreshed.Isn’t cool.

Download Class Diagram and FrameWork Diagram of Flex.[ At my Blog ]

February 11, 2008

To get a clear picture of the FLEX and its API you have to look at its Class Daigram and Framework Diagram Frequently.usually we dont find time but i suggest to frequent visit to these two pdf’s makes our brains healthy on FLEX and we become RICH in those areas.With these RIA.

This is the Class diagram of Flex, various Classes with its methods and Attributes are given init.

Flex-Class diagram

This is the FramWork Diagram of Flex.you can find diffent methods of Classes inti.

Flex-FrameWork Diagram.

Let us become “rich in minds” with these RIA’s FLEX.

Change the default cursor in Flex with Actionscript code:

February 11, 2008

Here the Class we got to use is CusrsorManager and some methods in it.

The following example shows the custom cursor on a Flex App.

public static const loaderCursor:Class;
var cursorId:int = CursorManager.setCursor(loaderCursor); 

The code will set the cursor ,to remove it use the line of code.


Thats it the default cursor is changed.

Default Style Applied to Flex App’s.

February 9, 2008

When we create a new Project in Flex Builder the Flex APP is applied with a Default style it looks greay.Now the Question is Where does this style comes from and where is this .css file present or what style is it.

The answer is the style applied to your Flex App is present in the Flex Builder installation Folder itself.

If you wanted to look at the style [ .css file ] look in the following path there is a Style file called ” defaults.css ” and that is the style applied to all the Flex APP’s.

C:Program FilesAdobeFlex Builder 2Flex SDK 2frameworksdefaults.css

Word of the Day “The more you explore the more your are intelligent”.

Iam writing this post because one of my team member asked “what’s the Application Background color” , it means that he/she missed some basics of FLEX.

“Beta Expired Error” :problem solved [ pictures ]

February 7, 2008

As i mentioned in the previous post we have to change the SDK’s and to do this download it from Adobe labs and paste it in the Adobe->Flex Builder->sdks-> folder the default name of the folder is enough to include, no need to change the folder names.

Now open your flex builder and open any project ,right click on the project select properties then you would get a screen like the below.


Select flex compiler and at the right hand you would fine “configure flex sdks“[marked in red] select it to include sdks.

Then the screen would be like the below.

add the sdks

Here click the add button[red marked] to add the sdks ..


Click browse button [red mark] to include those sdks which were pasted in flex builder -> sdks folder and they are include and after that check it and include those and they are included and error is expired.

Final screen to check the sdks..

error expired!

click apply[bottom red marke] button after checking up [red markd] including those new sdka.

Thats all the the problem is solved “The Error is finally expired” . And no need to install again Flex Builder.

Leave any comments for queries.

“Beta Expired Error” :Problem solved

February 6, 2008

Today strangely my Flex Builder showed an Error “Beta Expire Error“, i was really puzzled for that and i could not run my App, then i said to myself  “what the F@#$K” and  i started to find a solution for that and finally found  by the member of the Flex_india_comm and he shared it in his blog and iam doing it in my blog.

So here is the solution for that:

First the Error tells Beta Expired which means that your SDK’s are expired, a timer in that is set so that it can be used only to that specified time and it cannot be Reset.And that means we cannot further use those SDK’s and change those SDK’s, so for that i downloaded the SDK’s 3 [previous SDK's 2] from Adobe labs and i configured my project and added those new SDK’s to my projects, thats all  problem solved the Error Expired.

I will come back with screens for configuration 2mrow, until then take care.

Leave any comment for suggestion.

Generate XML data dynamically in Flex.

February 4, 2008

We may have a requirement were we wanted to generate XML data to send through Httpservice or create a XML page with it.

Then here to get that XML type data we could use a little bit of ActionScript code like below.

Here iam using XML Class and XMLList Class.

First iam defining my RootNode of type XML and then node name and node value of Type String and Then create a XMLList using this node name and node value,and then append this to XML RootNode using the method appendChild().Thats it ur XML data is created, now we can extend this to generate any number of XML lines type data.

Code Example:

private function createXML(): void
var xm:XML = <Relyon></Relyon>;
var nodeName:String = “EMPLOYEENAME”;
var nodeValue:String = “KUMAR”;
var xmlList:XMLList = XMLList(“<”+nodeName+”>”+nodeValue+”</”+nodeName+”>”);

This will do the JOB. Leave any comments for queries.

Traverse to previous page using JavaScript function.

February 1, 2008

When you are traveling to many pages you will have a requirement were you want to come back to the previous page[WEB page]. Then for this there is a function in JavaScript.

Function :


Define this in a function in the JS and call that function from Flex APP using the ExternalInterface method call(), [previous post describes this call] with a button, the the JS function is raised and the Page is Traversed.

JS Code:

function previousPage()




Refer previous post for ExternalInterface method call.


Get every new post delivered to your Inbox.