Saturday, August 29, 2009

Creating Flex Component Object when knowing only Class Name of the component

If you need to get a reference to a class in ActionScript 3, but you know only the class name,
then in that case you can use the "getDefinitionByName("class name string")" to create an instance of the class.

getDefinitionByName method is available in flash.utils package

This can be easily understandble by the simple example,


import flash.utils.getDefinitionByName;
var ClassReference:Class = getDefinitionByName("flash.display.MovieClip") as Class;


This creates an instance of the MovieClip class.getDefinitionByName method takes the entire class path,
so if you wanted to create an instance of MovieClip, you would provide the entire path:


var ClassReference:Class = getDefinitionByName("flash.display.MovieClip") as Class;


The following example shows how you can create a new Flex component instance by using
its class name by calling the getDefintionByName() method.

For creating Button component,

var cls:Class = getDefinitionByName("mx.controls.Button") as Class;

This will create instance to Flex Button Component,This is the same to

Button but_oj=new Button();


By using full class path with getDefinitionByName() method we can create instance to any class.

Read more...
Bookmark and Share

Tuesday, July 28, 2009

Getting Currently Selected item from Flex Tilelist Component



To day for some time i have struck with accessing the selected item in the tilelist component after trying out many methods.

fianlly i got the access to selected component of list by using the itemclick event of tilelist component.

In itemclick event we can get access to the selected item of the tile list .

By event.currentTarget will can get the currently clicked component of the particular tilelist component,

by using event.currentTarget.selecteditem we can get the selected item and

event.currentTarget.selectedindex will return the selected items index.

MXML Code:

<mx:TileList dataProvider="{chartAryCol}" id="chart"
itemClick="chartTileClick(event);" />

Action Script Code:
/*Item click event function */

private function chartTileClick(event:ListEvent):void
{
trace("Tile-target -->"+event.currentTarget.selectedItem);

}


event.currentTarget.selectedIndex give the index of the item clicked(selected)

Read more...
Bookmark and Share

Friday, April 17, 2009

Finding number of days between two dates in Flex

Today i found an interesting post an Flexexamples that by using simple basic arithmetic subtraction operator we can find the difference between the two different dates.
That is by subtracting one date from another date we can find out how many days are between those days.for example if you want to know the days between April 30-May28 means,just subtract April 30 from May 28 .here is the Flex code fragment to do this.

Actionscript Code:

private function calculateDays():String {
var tempDate:Date = new Date((new Date(2009,04,03)).getTime()
-(new Date(2009,03,30)).getTime());
return Math.round((tempDate.time / MS_PER_DAY) + 1).toString();
}



We can use this functionality to find the number of days in between the two selected dates in datechooser,or the days in the selected Range in Datechooser.Like that this functionality can be used where-ever the difference between the dates is needed.
Leave me a comment about this post.

Read more...
Bookmark and Share

Tuesday, April 07, 2009

Adobe Offerering Free Flex Builder 3 Professional IDE to Unemployed Developers,Students and Staff's of Educational Institutions

Adobe now offers Free Flex Builder 3 Professional IDE to Unemployed Developers,Students and Staff's.

To more details about this offering and get the IDE visit here :https://freeriatools.adobe.com/

Adobe also set some eligibility criteria to get this offer,here is that

For UnEmployed Developers :
To receive the product under this program, you must attest to the fact that you are currently unemployed and that the software will be used only for your personal use not for any production or commercial purposes.

I attest that the following statements are true: 
1) I am not currently employed or being paid to develop software applications or web pages 
2) Adobe Flex Builder 3 Software I receive under this program is for my personal use to learn about Adobe Flex and improve my skills 
3) My license to use Flex Builder 3 under this program will not be used for production or commercial purposes, nor will it be transferred to any other person or entity, including to my employer should I become employed.   - From Adobe

For more eligibility,terms and conditions  to get Free Flex Builder see at https://freeriatools.adobe.com/learnflex/            


For Students and Staff :
To receive the product, you must upload a valid proof of eligibility to get the serial numbers to activate the product. Valid proofs of eligibility are:
   1. a student ID showing current enrollment,
   2. a Faculty ID showing current employment
   3. an employee ID showing current employment, or
   4. a letter on an educational institution letterhead stating that you are either a current student, a current faculty member or a current employee of the institution. -From Adobe
For more eligibility,terms and conditions to get Free Flex Builder  see at https://freeriatools.adobe.com/flex/    

Read more...
Bookmark and Share

Wednesday, March 18, 2009

Stlying Flex Alert Using simple CSS

It is quiet easy to apply the style to get the good looking Flex Alert control . Playing with some simple CSS we can come up with more skinny Alert .here is one sample.


In this i have written the css to change the style of Alert title ,Alert message font color,Alert border,styles of shadow,headers etc,. 

Css Source:

Alert{
color : #124332;
background-color: #ffffff;
header-colors : #243322, #243322;
header-height:19;
drop-shadow-enabled: true;
drop-shadow-color :#243322;
corner-radius :6;
border-style :solid;
border-thickness: 1;
border-color : #243322;
footer-colors : #243322, #ffffff;
title-style-name : "title";
}

.title{
font-family :Verdana;
font-size :10;
font-weight :bold;
color :#ffffff;
}

Invoking Alert after applying the above style for the Alert in the Flex will display the Alert box like beolow


Script used to invoke the above Alert is,

Alert.show('Welcome To Flex','Greetings');


Read more...
Bookmark and Share

  © Blogger templates The Professional Template by Ourblogtemplates.com 2008

Back to TOP