Archive for the ‘Flex Interview Questions’ Category

Flex interview Questions

December 30, 2008

Some of the flex interview questions I had come across and asked to me. For the time being just putting up the questions. Will keep on adding answers whenever time permits. :) All the best, folks…

1) What’s the difference between Java and AS3 getters and setters?(*)

In Java, getter and setter methods have to be explicitly called.
While in AS3, they’re called automatically and externally
indistinguishable from public properties.

For instance trace(myClass.foo) might be referencing a public  property or it might be referencing the method “public get foo():Object”.  It makes no difference to an external class.

You can expand on this a bit more to describe why this is useful.  The
implications are that, unlike in Java, all variables in a class are
generally public.  Java standard practices are to create only public
getters and setters while keeping the variables private.  The reason
for only allowing methods to be publicly accessible is so that

1) they can be overridden and
2) their implementation can change without altering class interface.

AS3 addresses both of these concerns because, as described above, a
public property can be replaced with a getter and setter without
changing the interface.  And an inherited public property can actually
be overridden by a subclass.

For example, this is valid:
public class A
{
public var foo:Object;
}

public class B extends A
{
override public function get foo():Object{return ‘bar’};
override public function set foo(value:Object):void{};
}

2) Explain how binding works in mxml components.
or
Explain 3 different ways to achieve data binding

Data binding is the process of tying the data in one object to another object. It provides a convenient way to pass data around in an application. Adobe Flex 2 provides three ways to specify data binding: the curly braces ({}) syntax and the <mx:Binding> tag in MXML and the BindingUtils methods in ActionScript.

Data binding requires a source property, a destination property, and a triggering event that indicates when to copy the data from the source to the destination. To use a property as the source of a data binding expression, the component must be implemented to support data binding, which means that the component dispatches an event when the value of the property changes to trigger the binding.

At compile time, the MXML compiler generates code to create ActionScript Watcher and Binding objects that correspond to the binding tags and expressions found in an MXML document. At run time, Watcher objects are triggered by change events that come from the constituent parts of binding source expressions; the Watcher objects then trigger Binding objects to execute bindings.

When you specify a property as the source of a data binding, Flex monitors not only that property for changes, but also the chain of properties leading up to it. The entire chain of properties, including the destination property, is called a “bindable property chain“. In the following example, firstName.text is a bindable property chain that includes both a firstName object and its text property:

<first>{firstName.text}</first>

Its not necessary that the binding executes automatically. In the following case the binding wont execute automatically as expected.

  1. Binding does not execute automatically when you change an entire item of a dataProvider property.
  2. Binding also does not execute automatically for subproperties of properties that have [Bindable] metadata.
  3. Binding also does not execute automatically when you are binding data to a property that Flash Player updates automatically, such as the mouseX property.

The executeBindings() method of the UIComponent class executes all the bindings for which a UIComponent object is the destination. All containers and controls, as well as the Repeater component, extend the UIComponent class. The executeChildBindings() method of the Container and Repeater classes executes all of the bindings for which the child UIComponent components of a Container or Repeater class are destinations. All containers extend the Container class. However, you should only use the executeBindings() method when you are sure that bindings do not execute automatically.

3) What’s the difference between ChangeWatcher.watch, and BindingUtils.bindProperty?

Changewatcher.watch is used to watch the changes to a property and when that happens execute some function. BindingUtils.bind is used to bind a property of an object to another property of another object. In-fact the ChangeWatcher.watch() uses BindingUtils.bind to do the trick.

Eg : ChangeWatcher.watch(myObject, “myProperty”, myPropertyChanged);

Here, whenever the myProperty  of the object myObject is changed, the function (handler) myPropertyChanged is executed.

BindingUtils.bindProperty(textBox, “text”, myObject, “myProperty”);
Usually this is given in the creationComplete event. Here in this example, whenever myProperty of the object myObject is changed, the text property of the text box textBox is changed.

ChangeWatcher.watch returns a ChangeWatcher object, which can be saved to unwatch at later point of time.


4) Why would you want to keep a reference to a ChangeWatcher and call unwatch()?

The watch function returns an instance of ChangeWatcher which we can then use to do other things. The most important of this is to stop the ChangeWatcher. To stop watching we use a function named unwatch.

var cw:ChangeWatcher = ChangeWatcher.watch(myObject, “myProperty”,myPropertyChanged);

//when you want to stop watching

cw.unwatch();

5)How does Flex event system works?

Events let a developer know when something happens within a Flex application. They can be generated by user devices, such as the mouse and keyboard, or other external input, such as the return of a web service call. Events are also triggered when changes happen in the appearance or life cycle of a component, such as the creation or destruction of a component or when the component is resized. We can “handle” these events in our code by adding an event handler. Event handlers are the functions or methods that we write to respond to specific events. They are also sometimes referred to as event listeners.

The event model in Flex comprises the Event object and its subclasses, and the event dispatching model. We can instruct any container or control to listen for events dispatched by another container or control. When Flash Player dispatches an Event object, that Event object makes a roundtrip journey from the root of the display list to the target node, checking each node for registered listeners. The target node is the node in the display list where the event occurred. For example, if a user clicks a Button control named Child1, Flash Player dispatches an Event object with Child1 defined as the target node.The event flow is conceptually divided into three parts:

  • the capturing phase,
  • the targeting phase, and
  • the bubbling phase

During each of these phases, the nodes have a chance to react to the event. For example, assume the user clicks a Button control that is inside a VBox container. During the capturing phase, Flex checks the Application object and the VBox for listeners to handle the event. Flex then triggers the Button’s listeners in the target phase. In the bubbling phase, the VBox and then the Application are again given a chance to handle the event but now in the reverse order from the order in which they were checked in the capturing phase.

During any phase, we can stop the traversal of the display list by calling one of the following methods on the Event object:

  • stopPropagation()
  • stopImmediatePropagation()

We can call either the event’sstopPropagation()method or thestopImmediatePropagation()method to prevent an Event object from continuing on its way through the event flow. The two methods are nearly identical and differ only in whether the current node’s remaining event listeners are allowed to execute. ThestopPropagation()method prevents the Event object from moving on to the next node, but only after any other event listeners on the current node are allowed to execute.

ThestopImmediatePropagation()method also prevents the Event objects from moving on to the next node, but it does not allow any other event listeners on the current node to execute.

6) What is event Bubbling?

The mechanism through which event objects are passed from the objects that generates an event up through the containership hierarchy. Event bubbling means an event dispatched from a display object will bubble up the display list, starting from the object dispatching the event to the stage. An event only bubbles if itsbubblesproperty is set totrue. Mouse events and keyboard events are among those that bubble; it is less common for higher-level events that are dispatched by Flex to bubble. Events that can be bubbled includechange,click,doubleClick,keyDown,keyUp,mouseDown, andmouseUp. During the bubbling phase, Flex changes the value of thecurrentTargetproperty on the Event object to match the current node whose listener is being called. Thetargetproperty continues to refer to the dispatcher of the event.

7) How do you add event listeners in mxml components and AS3 components?

In AS3, we can do it like this :

addEventListener(“enableChanged”, enableChangedListener);

dispatchEvent(new Event(“enableChanged”));

In MXML it is more simple :

<MyComp:MyButton click=”handleClick(event);” creationComplete=”handleCreationComplete(event);”/>


8) What does calling preventDefault() on an event do?  How is this enforced?

Cancels an event’s default behavior if that behavior can be canceled.. For example, the doubleClick event has an associated default behavior that highlights the word under the mouse pointer at the time of the event. Your event listener can cancel this behavior by calling the preventDefault() method. You can use the Event.cancelable property to check whether you can prevent the default behavior associated with a particular event. If the value of Event.cancelable is true, then preventDefault() can be used to cancel the event; otherwise, preventDefault() has no effect.

9)What are the differences between Flex 2.0 and Flex 3.0?

These are some of the differences :

  • Native support for Adobe AIR – Flex 3 introduces new components and incorporates the Adobe AIR development tools into the SDK and Flex Builder.
  • Persistent framework caching – You can make Flex 3 applications as small as 50K when leveraging the new Flash Player cache for Adobe platform components. In fact the size of the resulting swf size had reduced for a larger bit.
  • Flex Builder productivity enhancements – Flex Builder 3 introduces refactoring support, new profilers for performance and memory tuning, and code generation tools for data access.
  • Integration with Creative Suite 3 – The Flex Component Kit for Flash CS3 allows Flash CS3 users to build components that can be seamlessly integrated into a Flex application, while Flex Builder 3 adds new wizards for importing assets from CS3 applications as skins.
  • Advanced DataGrid – The Advanced DataGrid is a new component that adds commonly requested features to the DataGrid such as support for hierarchical data, and basic pivot table functionality.
  • First steps toward open source Flex. As a first step toward making Flex an open source project, Adobe have opened up the Flex and Flex Builder bug tracking system to the public, as well as published detailed roadmap information.
10) What are some ways to specify styles on components?
  • declaring styles through CSS for each component
  • declaring style classes in CSS and giving the class name in styleName property of component
  • <mx:style> tag in MXML
  • using setStyle() method for AS3

11) What is the problem with calling setStyle()

When we are instantiating an object and setting the styles for the first time, we should try to apply style sheets rather than use the setStyle() method because it is computationally expensive. This method should only be used when we are changing an object’s styles during run time.

12) How do you use css styles in flex?
13) Explain different ways of using style sheets in Flex application.
14) Explain the difference between creating an effect and setting the target as opposed to adding an effectListener
15) What do repeater components do?
16. How do you use a repeater?
17) How do you identify a component created in a repeater?
18) Explain the component lifecycle.
or
Explain the UI component life cycle including important methods like initialize() and createChildren()
or
What are the methods called when a UI component is intialized?

Preinitialize: The application has been instantiated but has not yet created any child components.

CreateChildren:Flex calls the createChildren() method in response to the call to the addChild() method to add the component to its parent.

invalidateProperties(): marks a component so that its commitProperties() method gets called during a later screen update.

invalidateSize (): Marks a component so that its measure() method gets called during a later screen update.

invalidateDisplayList (): Marks a component so that its updateDisplayList() method gets called during a later screen update.

Initialize: The application has created child components but has not yet laid out those components.

CommitProperties:Flex calls the commitProperties() method when you use the addChild() method to add a component to a container, or when you call the invalidateProperties() method of the component. Calls to the commitProperties() method occur before calls to the measure() method. This lets you set property values that might be used by the measure() method.
Calls the component’s measure() method.

Measure : calculates the default size, and optionally the default minimum size, of the component. This is an advanced method that you might override when creating a subclass of UIComponent.
The default implementation of measure() sets measuredWidth, measuredHeight, measuredMinWidth, and measuredMinHeight to 0.

LayoutChrome:Calls the component’s (Adobe help mention this method is in UIComponent where as it is in container class) container’s layoutChrome() method.
The Container class, and some subclasses of the Container class, use the layoutChrome() method to define the border area around the container.
Calls the component’s updateDisplayList() method.

UpdateDisplayList(): method sizes and positions the children of your component based on all previous property and style settings, and draws any skins or graphic elements that the component uses. The parent container for the component determines the size of the component itself.

UpdateComplete :Dispatched when an object has had its commitProperties(), measure(), and updateDisplayList() methods called (if needed). This is the last opportunity to alter the component before it is displayed. All properties have been committed and the component has been measured and layed out.

creationComplete: The application has been completely instantiated and has laid out all components

For an ultimate guid see here : http://flexcomps.wordpress.com/2008/05/09/flex-component-life-cycle

19) How invalidate / commitProperties work specifically
20) Questions about dataServices
21) A general understanding of MVC
or
How do you implement MVC in your application
or
what is MVC and how do you relate it to flex apps?
22) Is it possible to make httpService Requests synchronous?(*)

A: No.Basically all service calls from flex, whether it is HTTPService, WebService or RemoteService, are asynchronous. But there are methods through which you can crack this and make these calls synchronous.

Solution 1 (I got from many sites): Create XMLHttpRequest with Javascript in Flex, and call a server data with the parameters we will give to the object.For example: xmlHttpRequest.open(“GET”,”http://localhost/Default.aspx&#8221;,false);

1. Request Type: GET or POST
2. Requested URL
3. Communication Type: true for asynchronous, false for synchronous.

Solution 2 (My Own Solution ;) ): Create one result handler for the service call and whatever processing you need to execute synchronously, put all in that result handler and BINGO!!! :)

23) I need to load an image from flickr into my application. Do I need a crossdomain.xml file on flickr?
24) Explain crossdomain.xml and why is it used?
25)Describe what the IResponder interface contains and how is it used?
26) What is the difference between httpService and Data Service? (*)

Flex allows three types of RPC services: HttpService, WebServices, and RemoteObject Services. In Flex, using the “RemoteObjects specifies named or unnamed sources and connects to an Action Message Format (AMF) gateway, whereas using the HTTPService and WebService use named services or raw URLs and connect to an HTTP proxy using text-based query parameters or XML”. Specifically, HTTPServices use raw HTTP requests, WebServices use the SOAP protocol and RemoteObjects uses AMF3. “RemoteObject provides two advantages over HTTP or SOAP. First, while the AMF protocol uses HTTP to transfer packets, the data is transferred in a binary format that is natively understood by the Flash Player. As a result, data can move across the network more quickly and it can be deserialized more rapidly than text-based formats such as XML. Both of these result in performance gains, particularly where large sets of data are involved. Secondly, RemoteObject provides signficant productivity advantages. The remoting service, which runs on your server, automatically marshalls data between AMF and your server-side language (e.g., PHP, Java, C#). As a result, you can directly call methods on your PHP objects without having to write an XML REST interface or create web service interfaces”.

27) How do you generate random numbers within a given limit with actionscript?
function randomNumber(low:Number=0, high:Number=1):Number{
  return Math.floor(Math.random() * (1+high-low)) + low;
}

28) Have you built any components with actionscript? If so explain how you did it?
29)How do you implement push on a flex applications?

30)How do you implement push with flex data services?
31)I am going to add images into a tag. How will it resize itself?
32)What is a resource Manager?
33)What are the similarities between java and flex

Both can be used as client application, both have packages, OOP based , support XML , import external packages, up casting, support ArrayCollection ,almost same primitive data types, both support class library packaging( .jar , .swc).


34)How do you implement drag and drop on components that do not support ondrag and ondrop?

35)What is a drag manager?
36)Can you write to the file system from flex?
37)HOw do you call javascript from Flex?

The ExternalInterface API makes it very simple to call methods in the enclosing wrapper. You use the static call() method, which has the following signature:

flash.external.ExternalInterface.call(function_name:
    String[, arg1, ...]):Object;

The function_name is the name of the function in the HTML page’s JavaScript. The arguments are the arguments that you pass to the JavaScript function. You can pass one or more arguments in the traditional way of separating them with commas, or you can pass an object that is deserialized by the browser. The arguments are optional.

The following example script block calls the JavaScript f() function in the enclosing wrapper by using the call() method:

<mx:Script>
<?xml version="1.0" encoding="iso-8859-1"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script>
        import flash.external.*;

        public function callWrapper():void {
            var f:String = "changeDocumentTitle";
            var m:String = ExternalInterface.call(f,"New Title");
            trace(m);
        }
    </mx:Script>
    <mx:Button label="Change Document Title" click="callWrapper()"/>
</mx:Application>

On your HTML page, you define a function as you would any other JavaScript function. You can return a value, as the following example shows:

<SCRIPT LANGUAGE="JavaScript">
    function changeDocumentTitle(a) {
        window.document.title=a;
        return "successful";
    }
</SCRIPT>

This feature requires that the embedded movie file have an id attribute. Without it, no call from your Flex application will succeed.

The call() method accepts zero or more arguments, which can be ActionScript types. Flex serializes the ActionScript types as JavaScript numbers and strings. If you pass an objct, you can access the properties of that deserialized object in the JavaScript, as the following example shows:

<mx:Script>
    public function callWrapper():void {
        var o:Object = new Object();
        o.lname = "Danger";
        o.fname = "Nick";
        var f:String = "sendComplexDataTypes";
        ExternalInterface.call(f,o);
    }
</mx:Script>

Flex only serializes public, nonstatic variables and read-write properties of ActionScript objects. You can pass numbers and strings as properties on objects, simple objects such as primitive types and arrays, or arrays of simple objects.

The JavaScript code can then access properties of the object, as the following example shows:

<SCRIPT LANGUAGE="JavaScript">
    function sendComplexDataTypes(a:Object) {
        alert("Welcome " + a.fname + " " + a.lname + "!");
    }
</SCRIPT>

You can also embed objects within objects, as the following example shows. Add the following code in your Flex application’s <mx:Script> block:

<mx:Script>
    public function callWrapper():void {
        var f:String = "sendComplexDataTypes";
        var o:Object = new Object();
        o.lname = "Danger";
        o.fname = "Nick";
        o.b = new Array("DdW","E&T","LotR:TS");
        var m:String = ExternalInterface.call(f,o);
    }
</mx:Script>

The code triggers the following JavaScript in the wrapper:

<SCRIPT LANGUAGE="JavaScript">
    function sendComplexDataTypes(a) {
        // Get value of fname and lname properties.
        var m = ("Welcome " + a.fname + " " + a.lname + "!\n");
        // Iterate over embedded object's properties.
        for (i=0; i<a.b.length; i++) {
            m = m + a.b[i] + "\n";
        }
        alert(m);
    }
</SCRIPT>

Flex and Flash Player have strict security in place to prevent cross-site scripting. By default, you cannot call script on an HTML page if the HTML page is not in the same domain as the Flex application. However, you can expand the sources from which scripts can be called.

You cannot pass objects or arrays that contain circular references. For example, you cannot pass the following object:

var obj = new Object();
obj.prop = obj; // Circular reference.

Circular references cause infinite loops in both ActionScript and JavaScript.

38) what are three ways to skin a component in flex?
39)what is state? what is the difference between states and ViewStack?
40)how does item renderer work? How do I add item renderer at runtime?
41)what keyword allows you to refer to private variables of a class?
42)how polymorphism works on actionscript?
43)how do you overload functions in actionscript?
44)How to override Managers (example : PopupManager)
45)what is dynamic keyword used for?
or
What is the difference between sealed class and dynamic classes?

Dynamic Keyword is used to make a class dynamic. A dynamic class defines an object that can be altered at run time by adding or changing properties and methods. You create dynamic classes by using the dynamic attribute when you declare a class. For example, the following code creates a dynamic class named Protean:

dynamic class Protean {
  private var privateGreeting:String = "hi";
  public var publicGreeting:String = "hello";
  function Protean () {
    trace("Protean instance created");
  }
}

If you subsequently instantiate an instance of the Protean class, you can add properties or methods to it outside the class definition. For example, the following code creates an instance of the Protean class and adds a property named aString and a property named aNumber to the instance:

var myProtean:Protean = new Protean();
myProtean.aString = "testing";
myProtean.aNumber = 3;
trace (myProtean.aString, myProtean.aNumber); // output: testing 3

Properties that you add to an instance of a dynamic class are run-time entities, so any type checking is done at run time. You cannot add a type annotation to a property that you add in this manner.

You can also add a method to the myProtean instance by defining a function and attaching the function to a property of the myProtean instance. The following code moves the trace statement into a method named traceProtean():

var myProtean:Protean = new Protean();
myProtean.aString = "testing";
myProtean.aNumber = 3;
myProtean.traceProtean = function () {
    trace (this.aString, this.aNumber);
}
myProtean.traceProtean(); // output: testing 3

Methods created in this way, however, do not have access to any private properties or methods of the Protean class. Moreover, even references to public properties or methods of the Protean class must be qualified with either the this keyword or the class name. The following example shows the traceProtean() method attempting to access the private and public variables of the Protean class.

myProtean.traceProtean = function () {
    trace(myProtean.privateGreeting); // output: undefined
    trace(myProtean.publicGreeting); // output: hello
}
myProtean.traceProtean();

Sealed Class

A class that is not dynamic, such as the String class, is a sealed class. You cannot add properties or methods to a sealed class at run time.

46) What are runtime shared libraries?
47) What is cairngorm ? How do you use it? Have you worked with
cairngorm?
or
 
Explain the lifecycle of a Cairngorm action.
or
What frameworks familiar with

Some of the frameworks in Flex are : PureMVC, EasyMVC, Cairngorm, Mate, Swiz. I had worked only on cairngorm and so putting down its details :

Overview of Cairngorm

What is Cairngorm? Cairngorm is fundamentally a methodology for breaking up your application code by logical functions; by data, by user views, and by the code that controls everything. This is routinely referred to as MVC, or Model, View, and Control.

The Pieces of Cairngorm

·Model Locator: Stores all of your application’s Value Objects (data) and shared variables, in one place. Similar to an HTTP Session object, except thatits stored client side in the Flex interface instead of server side within a middle tier application server.

· View: One or more Flex components (button, panel, combo box, Tile, etc) bundled together as a named unit, bound to data in the Model Locator, andgenerating custom Cairngorm Events based on user interaction (clicks,rollovers, dragndrop.)

· Front Controller: Receives Cairngorm Events and maps them to CairngormCommands.

· Command: Handles business logic, calls Cairngorm Delegates and/or other Commands, and updates the Value Objects and variables stored in the ModelLocator

· Delegate: Created by a Command, they instantiate remote procedure calls(HTTP, Web Services, etc) and hand the results back to that Command.

· Service: Defines the remote procedure calls (HTTP, Web Services, etc) to connect to remote data stores.

How the Pieces Fit Together

Cairngorm basically works like this: Your client interface is comprised of Views. The Views use Flex binding to display data contained in the Model Locator. The Viewsgenerate Events based on user gestures such as mouse click, button press, and drag & drop. Those Events are “broadcast” and “heard” by the Front Controller, which is a map of Events to Commands. Commands contain business logic, create Delegates toperform work, handle responses from Delegates, and update the data stored in theModel Locator. Since Views are bound to the data in the Model Locator the Viewsautomatically update when the Model Locator data is changed. Delegates callServices and hand results back to Commands, and are optional but recommended.Services make remote data calls and hand the results back to Delegates.

48) What keyword allows you to implement abstraction better?
49) What is ClassFactory and why is it needed?
50) What design patterns have you used? in Actionscript and java?
or
What design patterns do you commonly use?
51) What is AMF?

AMF is a binary format based loosely on the Simple Object Access Protocol (SOAP). It is used primarily to exchange data between an Adobe Flash application and a database, using a Remote Procedure Call. Each AMF message contains a body which holds the error or response, which will be expressed as an ActionScript Object. AMF was introduced with Flash Player 6, and this version is referred to as AMF 0. It was unchanged until the release of Flash Player 9 and ActionScript 3.0, when new data types and language features prompted an update, called AMF 3.

52) What are the Advantages and Disadvantages of flex

Flex advantages: very capable IDE, Images are part of a flash movie and can’t be downloaded directly, supported by Adobe, XML based language, ability to leverage flash components into the application, great speed increase over previous versions of flash (if that was even possible).

Flex disadvantages: Needs the flash player, Need to learn and XML based language and possibly actionscript to build real applications, initial loading is slow.

53) What is the difference between Flex and AIR application?

The “Flex Framework” is a collection of AS3 classes and components used in developing RIAs. ” If you use something other than Flex Builder to develop in Flex, you need to download the Flex SDK to compile. The end result of a compiled Flex Application is an SWF file (Same as Flash). With the compiled SWF file, a user only needs to have Flash Player installed to run the application. Most Flex apps are developed, deployed to a server and then a web browser is used to serve the application to the user for use.

AIR is an alternative delivery system for Flex Applications, replacing the web server and browser so to speak. It’s primary purpose is for deploying RIAs to a user’s desktop, independant of an internet connection. AIR, also allows for the use of HTML, AJAX etc. So an AIR Application could be a collection of all these things, compiled together. To run an AIR Application, you need AIR Runtime installed on your computer.

54) List out the advantages and disadvantages of using Raster vs Vector images with flex.
55) What are the config files that are used to connect Java and Flex applications?

data-management-config.xml – The Data Management Service configuration file, which defines Data Management Service destinations,
messaging-config.xml – The Messaging Service configuration file, which defines Messaging Service destinations for performing publish subscribe messaging,
proxy-config.xml – The Proxy Service configuration file, which defines Proxy Service destinations for working with web services and HTTP services (REST services),
remoting-config.xml – The Remoting Service configuration file, which defines Remoting Service destinations for working with remote objects,
services-config.xml – The top-level BlazeDS configuration file. This file usually contains security constraint definitions, channel definitions, and logging settings that each of the services can use. It can contain service definitions inline or include them by reference. Generally, the services are defined in the remoting-config.xml, proxy-config.xml, and messaging-config.xml.

56)Explain what a weak-referenced event listener is and why you’d use it?
or
What is the difference between Strong Reference and Weak Reference?
57)Explain the invalidation model and how it works for properties, measuring and the display list.
58)What classes do you typically extend in the Flex SDK for creating GUI controls and why?
59)What is something you’ve coded that you were most proud of?
60)What is something you’ve coded that you were ashamed of?
61) What is the difference between width, explicitWidth, measuredMinWidth, measuredWidth, and percentWidth?

width : Number that specifies the width of the component, in pixels, in the parent’s coordinates.
explicitWidth
: The explicitly specified width for the component, in pixels, as the component’s coordinates.
measuredMinWidth
: The default minimum width of the component, in pixels.
measuredWidth
: The default width of the component, in pixels.
percentWidth
: Number that specifies the width of a component as a percentage of its parent’s size.

62) What are field classes?
63) What is method closure in AS3?
64) Is there private constructors in Flex?

No. ActionScript 3 does not support private or protected constructors

65) Design patterns used in Flex / AS3?
66) How will you implement Singleton Pattern?

ActionScript 3 does not support private or protected constructors preventing common implementation techniques for the singleton pattern. By using a static initializer and a check in the constructor, it is possible to ensure only a single instance of a class is created.

package{
    public final class Singleton{
        private static var _instance:Singleton = new Singleton();
        public function Singleton(){
            if (_instance != null){
                throw new Error("Singleton can only be accessed through Singleton.instance");
            }
        }
        public static function get instance():Singleton{
            return _instance;
        }
    }
}
67) Is it possible to communicate between the two open swf files in different browsers?
68) How is MXML files getting compiled?(*)

MXML files are first get converted to the corresponding actionscript classes. These actionscript classes as well the original actionscript classes are compiled by the flex compiler to get the swf file. SWF will acts as a bytecode similar to that of Java, which recognised by the Flash Player.

MXML Compilation Step
69) What is the difference between metadata and script tag? (Irrelavant, but I was asked once :P )

Metadata tags are inserted into the MXML and ActionScript files to provide information to the Flex compiler. Metadata tags do not get compiled into executable code, but provide information to control how portions of the code get compiled. Metadata tags provide information to the Flex compiler that describes how the components are used in a Flex application. For example, you might create a component that defines a new event. To make that event known to the Flex compiler so that you can reference it in MXML, you insert the[Event]metadata tag into your component.

<mx:Script> tag is used to define blocks of ActionScript code. ActionScript blocks can contain variable and function definitions. ActionScript code can be placed in blocks, in the body of the tag, or you can include an external file by specifying the source with the source property of the tag, as shown below: <mx:Script source=”file_name.as” />. The script within an <mx:Script> tag is accessible from any component in the MXML file.

70) Which is the base class to extend in a custom component, in order to dispatch an event?

The EventDispatcher class is the base class for all classes that dispatch events. The EventDispatcher class implements the IEventDispatcher interface and is the base class for the DisplayObject class. The EventDispatcher class allows any object on the display list to be an event target and as such, to use the methods of the IEventDispatcher interface. Since the UIComponent class inherits EventDispatcher all the components based out of UIComponent can dispatch an event.

 
 71) Different invalidate and validate methods in Flex custom component.
        or
        What do each invalidate and validate methods do?
72) Things to do while creating a new Custom component.
73) What are the different data types datagrid can accept?

The dataprovider property is of data type Object. This property lets you use most types of objects as data providers. If you set the dataProvider property to an Array, it will be converted to an ArrayCollection. If you set the property to an XML object, it will be converted into an XMLListCollection with only one item. If you set the property to an XMLList, it will be converted to an XMLListCollection. If you set the property to an object that implements the IList or ICollectionView interface, the object will be used directly.As a consequence of the conversions, when you get the dataProvider property, it will always be an ICollectionView, and therefore not necessarily be the type of object you used to you set the property.

74) Which class does mx:Application document extends?

An Application document is a class that extends mx.core.Application

75) How will you remove the first element from the Array?

The elements from the Array can be removed by using splice method. splice method accepts mainly two arguments. First one tells the starting index and second one the number of elements to be retrieved. This will return an array of the spliced elements. See the code below. :

            var arr:Array = new Array(“a”,”b”,”c”,”d”);
Alert.show(arr.toString());
arr = arr.splice(1,arr.length-1);
Alert.show(arr.toString());
76) How is BlazeDS working?
77) What are the differences between the Datagrid and AdvancedDataGrid
78)How is remoting working internally?
79)How will you pass the parameters into HTTPService
80)Difference between Array and Arraycollection

The main difference between both these are :

  1. The elements of the ArrayCollection can be used in bindings that will be continued to be monitored. This is not the case with the normal Array class, once the element from an array is used in a binding, it is no longer monitored.
  2. ArrayCollection provides a rich set of tools for data manipulation

The ArrayCollection class is a wrapper class that exposes an Array as a collection that can be accessed and manipulated using the methods and properties of the ICollectionView or IList interfaces. Operations on a ArrayCollection instance modify the data source; for example, if you use the removeItemAt() method on an ArrayCollection, you remove the item from the underlying Array. Apart from the native methods like push, pop and length provided by Array class, ArrayCollection provides advanced methods such as addItemAt, removeItemAt. Apart from that ArrayCollection members can be used for binding internally, but flex won’t guarantee binding for individual elements of the Array.

81)What are the duties of IResponder

82)What are the different channels used in BlazeDs

83)What are end points in BlazeDs

84)How do you specify the path of Data Configuration File while compilation

or

Why do we need to provide the data configuration file path as a compile time parameter while compiling.

85)What is the parameter useWeakReference do in the addEventListener function.

86)What is the use of metadata and what all things we can define in Metadata? How will the metadata will be compiled at the time of compilation?

87)How many instances of command class would be created if the event is dispatched in a loop of 100 times in Cairngorm?

88)How many ways objects can be created and what are they?

89)Compiler options

90)What is RemoteClass and is there any other replacement for RemoteClass?

91)Explain garbage collection in Flex/Flash Player. How can we manually trigger the garbage collection?


Follow

Get every new post delivered to your Inbox.

Join 95 other followers

%d bloggers like this: