Sunday, May 30, 2010

Some very rare Interview Questions which you usually won't find easily !!!

1. How to find number of instances of a class in run time ?

Ans: You can declare a static variable for that class and increment that variable in the class constructor. As we know static variable is shared across the all instances of the class so you will be able get the number of instances at run time.

2. Lets assume you have 10 images you want to arrange them vertically with padding of 10, you can not use any built in layout or any property.write action script logic for it.


Ans: lets assume we have a imageArray that contains the 10 images.

for ( var i:int = 0; i if ( i !=0) {
imgArray[i].y = imgArray[i-1].y+imgArray[i-1].height+10;
}
}

3. You have a datagrid, in that you want 3 checkboxes as item-renderer.How will you achieve it ?

Ans: As per the requirement you want 3 checkboxes as item-renderer so we can not use inline item-renderer.For this you can write a class in that you can create 3 checkboxes and give this class as a item-renderer to datagrid.