Search Flex Components Free

Custom Search

June 9, 2009

Flex questions

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.

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 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 createActionScript 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:

{firstName.text}

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.

he 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 Repeatercomponent, extend the UIComponent class. TheexecuteChildBindings() method of the Container and Repeater classes executes all of the bindings for which the childUIComponent 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?
4) Why would you want to keep a reference to a ChangeWatcher and call
unwatch()?

5) How do you add event listeners in mxml components. Now AS3 components?
6) What does calling preventDefault() on an event do? How is this
enforced?
7) (If applicable) Explain the lifecycle of a Cairngorm action.

8 ) What are some ways to specify styles on components?
9) What is the problem with calling setStyle()
10) Explain the difference between creating an effect and setting the
target as opposed to adding an effectListener
11) What do repeater components do?
12) How do you identify a component created in a repeater?

13) Explain the component lifecycle.
14) How invalidate / commitProperties work specifically
15) Questions about dataServices
16) A general understanding of MVC
17) What frameworks familiar with

1. Is it possible to make httpService Requests synchronous?
2. I need to load an image from flickr into my application. Do I need a crossdomain.xml file on flickr?
3. 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”.

4. How do you generate random numbers within a given limit with actionscript?
5. Have you built any components with actionscript? If so explain how you did it?
6. How do you implement push on a flex applications?
7.I am going to add images into a tag. How will it resize itself?
8. What is a resource Manager??
9.What are the similarities between java and flex
10. What is the dynamic keyword used for?
11.How do you implement push with flex data services?
12. What are the methods called when a UI component is intialized?
13. How do you implement drag and drop on components that do not support ondrag and ondrop?
14.Can you write to the file system from flex?
15. What is a drag manager?
16 . 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:

17. How do you use a repeater?
18. what are three ways to skin a component in flex?
19. How do you use css styles in flex?
20. What is the difference between sealed class and dynamic classes?
21.what is MVC and how do you relate it to flex apps?
22.what is state? what is the difference between states and ViewStack?
23.how does item renderer work? How do I add item renderer at runtime?
24.what keyword allows you to refer to private variables of a class?
25.how polymorphism works on actionscript?
26.how do you overload functions in actionscript?
27.what is dynamic keyword used for?

Dynamic Keyword is used to make a class dynamic. A dynamicclass 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 namedProtean:

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.

31.What keyword allows you to implement abstraction better?
32.What design patterns have you used? in Actionscript and java?

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.

Advantages / 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

Related Flex Tutorials