Culture Magazine

Top 25 Flex Interview Questions

By Ajeethboaz

Top 25 Flex interview questions

1. Life cycle of flex appln/component?

* Pre initialize : The Appln has been initiated but has not yet created any child components.
* Initialize :The Appln has created child components but has not yet laid out those components.
* Creation Complete : The Appln has been completely initiated and has laid out all components.

2.Types of binding:

*using curly braces ({})
*using Action script expressions in curly braces
*using the tag in mxml
*using bindings in Actionscript (Binding utils)

3.Event Bubbling:

The mechanism through which event objs are passed from the objs that generates an event up through the containership hierarchy.

4.Different ways of using style sheets?

*using external style sheets
*using local style definitions
*using the style manager class
*using the set style() getstyle() methods
*using inline styles loading style sheets at runtime

5.How can u use 2 styles at the same time?

Using external style sheets and inline style commands.

6.How will u call java method from flex?

Using Remote object.

7.What are the config files used for connecting java and flex?

*data- management-config.xml
*messaging-config.xml
*proxy-config.xml
*remoting-config.xml
*services-config.xml

8.How can u call Javascript from MXML?
IExternalInterface.call()

9.How can u access a variable defined in 1 MXML file to another?
Create 1 obj of mxml file into another mxml file.

10. How do u generate random numbers within a given limit with Action script?
randNum:Number = Math.random()*100;

11.What is the difference between httpService & Data Service?
Basically, 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.
The Flex presentation layer communicates with the business layer by using Flex data services, which are objects we insert in a Flex file. Specifically, we can use Flex data services to interact with the following:
* Web services
* HTTP services
* Remote objects
A Flex data service is an object we insert in an MXML file to communicate with the business layer of a multi-tier application. We use data services to send and receive data from web services, HTTP URLs, and remote objects such as server-based Java objects. An HTTP service is nothing more than an HTTP request to a URL. The primary purpose of HTTP services is to retrieve XML data from an external source.
“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 significant productivity advantages. The remoting service, which runs on our server, automatically marshals data between AMF and our server-side language (e.g., PHP, Java, C#). As a result, we can directly call methods on our PHP objects without having to write an XML REST interface or create web service interfaces”.
There are other ways to pass the data from Flex to a server-side Web application. For example, we can create an instance of the URLVariables object, create the data to be passed as its properties,attach URLVariables to URLRequest.data, and call navigateToURL().

12.What is the difference between Flex 2.0 & 3.0?

• 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 – We 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.

Enhanced Features like Faster compilation time, SWF file size reduction, Flex/Ajax Bridge, Advanced DataGrid, Interactive debugging, Cross-Domain, Versionable, Easy to Use, Security and Code Signing, Failover and Hosting, Cross-Domain RSL, Advanced DatagridDeep Linking, Resource Bundles and Runtime Localization, Flex Component Kit for Flash CS3, Compilation, Language IntelligenceRefactoring, Class Outline, Code Search, Profiler, Module Support, Multiple SDK Support, Skin Importer, Design View Zoom/Pan, Design Mode support for ItemRenderers, Advanced Constraints, CS3 Suite integration, CSS Outline, CSS Design View, Flex 3 SDK Skinning/Style Enhancements.

13.What are the three ways to skin a component?

*Graphical skins
*Programatic skins
*Stateful skins

14.Similarities between Flex & Java?

*both can be used as client applns
*both have packages
*Oop based
*Support xml
*import external packages
*Upcasting
*Support Array collection
*Amost same primitive data types
*both support class library packaging(.jar,.swc)

15.What are channels & their types in flex?

*Channel is the base class of message channel class
*Here all the channel in messaging must extend this class
*Channels are specific protocol based conduits for messages sent between message agents and remote destinations.

16. What is an event class in Flex?

The flash.events.Event class is an ActionScript class with properties that contain information about the event that occurred. An Event object is an implicitly created object, similar to the request and response objects in a JavaServer Page (JSP) that are implicitly created by the application server.

Flex creates an Event object each time an event is dispatched. You can use the Event object inside an event listener to access details about the event that was dispatched, or about the component that dispatched the event. Passing an Event object to, and using it in, an event listener is optional. However, if you want to access the Event object’s properties inside your event listeners, you must pass the Event object to the listener.

Flex creates only one Event object when an event is dispatched. During the bubbling and capturing phases, Flex changes the values on the Event object as it moves up or down the display list, rather than creating a new Event object for each node.

17. What is an event sub class?
There are many classes that extend the flash.events.Event class. These classes are defined mostly in the following two packages:

* mx.events.*
* flash.events.*

The mx.events package defines event classes that are specific to Flex controls, including the DataGridEvent, DragEvent, and ColorPickerEvent. The flash.events package describes events that are not unique to Flex but are instead defined by Flash Player. These event classes include MouseEvent, DataEvent, and TextEvent. All of these events are commonly used in Flex applications.

In addition to these packages, some packages also define their own event objects: for example, mx.messaging.events.ChannelEvent and mx.logging.LogEvent.

Child classes of the Event class have additional properties and methods that may be unique to them. In some cases, you will want to use a more specific event type rather than the generic Event object so that you can access these unique properties or methods. For example, the LogEvent class has a getLevelString() method that the Event class does not.

18. What is an Event Propagation?
When events are triggered, there are 3 phases in which Flex checks whether there are event listeners.
3 phases are:
* Capturing
* Targetting
* Bubbling

19.Benefits of flex?
Advantages:
* It runs on the flash player, which can be found almost everywhere.
* It’s backed by a major company, Adobe.
* There are plenty of frameworks and tools built for and around it from Adobe and the community.
* IDE support comes from Adobe with FlashBuilder, and Jetbrains with Intellij.
* Developing RIA with Flex can be considered easier than with HTML and JavaScript.
* Flex apps can easily run outside the browser, and offline.

Disadvantages:
* HTML5 is here and is supported by everyone. Even by Adobe and Microsoft.
* There is no good alternative flash player like there are alternative web browsers.
* Flash is proprietary and not a web standard.
* Flex is no longer open source, and neither IDE tools are free.

20.How do u implement PUSH on a flex appln?

* using BlazeDS server, livecycle data services.

21. Difference between Java & Flex Getters Setters

Java
* never a good idea to make member variable public
* java only has explicit getter

Flex
* Creating public memeber variable is “Safe”
* flex can have both implicit & explicit getters

22. How can u implement singleton in flex?

Singleton pattern is a design pattern that is used to restrict instantiation of a class to one object.

if u create a class as a singleton , then no way to create more than one instance.

23. What are the 2 ways to compile flex source file?

* directly save .mxml file in bin directory of your flex folder(bin dir is the place where the flex compiler is located)
* apache’s ant technology, a build.xml file is created & is used to call the flex compiler and compile the flex.mxml file.

24. Arrays in flex

Arrays allow you to store multiple values in a single data structure.

Indexed arrays

Indexed arrays store a series of one or more values organized such that each value can be accessed using an unsigned integer value. The first index is always the number 0, and the index increments by 1 for each subsequent element added to the array. As the following code shows, you can create an indexed array by calling the Array class constructor or by initializing the array with an array literal:

// Use Array constructor.
var myArray:Array = new Array();
myArray.push(“one”);
myArray.push(“two”);
myArray.push(“three”);
trace(myArray); // output: one,two,three

// Use Array literal.
var myArray:Array = ["one", "two", "three"];
trace(myArray); // output: one,two,three

The Array class also contains properties and methods that allow you to modify indexed arrays. These properties and methods apply almost exclusively to indexed arrays rather than associative arrays.

Indexed arrays use an unsigned 32-bit integer for the index number. The maximum size of an indexed array is 232 – 1 or 4,294,967,295. An attempt to create an array that is larger than the maximum size results in a run-time error.
Associative arrays

An associative array, sometimes called a hash or map, uses keys instead of a numeric index to organize stored values. Each key in an associative array is a unique string that is used to access a stored value.

There are two ways to create associative arrays in ActionScript 3.0. The first way is to use the Object constructor, which has the advantage of allowing you to initialize your array with an object literal. An instance of the Object class, also called a generic object, is functionally identical to an associative array. Each property name of the generic object serves as the key that provides access to a stored value.

The following example creates an associative array named monitorInfo, using an object literal to initialize the array with two key and value pairs:

var monitorInfo:Object = {type:”Flat Panel”, resolution:”1600 x 1200″};
trace(monitorInfo["type"], monitorInfo["resolution"]);
// output: Flat Panel 1600 x 1200

If you do not need to initialize the array at declaration time, you can use the Object constructor to create the array, as follows:

var monitorInfo:Object = new Object()

25.Difference between flex and flash?

Flash

* specifically designed s/w for designer cos they can create anything without code
* provides number of tools for drawing to create graphics
* u have to spend countless hours for creating attractive framework for your project or website

Flex

* more oriented for developers,includes almost every feature of web development
* does not provide any tools for designing , but with use of stylesheets,properties or components we can design
* flex provides the framework applications which includes in built components to design or develop complex appln and with the use of components can save ur time….

Top 25 Flex interview questions
Top 25 Flex interview questions
Top 25 Flex interview questions


Back to Featured Articles on Logo Paperblog

Magazines