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.

mTimer.addEventListener(TimerEvent.TIMER_COMPLETE,Comple);

start the Timer.At a needed location.

mTimer.start();

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.source=txtuname;
strVal.required=true;
strVal.requiredFieldError=”Enter Your User Name”;
var bill_result1:ValidationResultEvent=strVal.validate();
if(bill_result1.type==ValidationResultEvent.INVALID)
{
txtuname.setFocus();
Alert.show(bill_result1.message,this.title);
}

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.

<mx:Style>
.subDateChooser {
backgroundColor: black;
color: white;
fontweight:bold
}
</mx:Style>

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.

mTimer.addEventListener(TimerEvent.TIMER,Countsec);
mTimer.addEventListener(TimerEvent.TIMER_COMPLETE,Comple);

Now start time.

mTimer.start();

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

private function Countsec(e:TimerEvent):void
{
lbltime.text=e.target.currentCount;
}
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)”/>
<mx:Script>
<![CDATA[
private function reloadpage(event:MouseEvent):void
{
var ref:URLRequest = new URLRequest("javascript:location.reload(true)");
navigateToURL(ref, "_self");
}
]]>
</mx:Script>
</mx:Application>

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.


Follow

Get every new post delivered to your Inbox.