flex q&a

54
Flex, Actionscript, OOPS Questionaaire 1. Which of the following statements uses a valid URL scheme? a. Var dataFile:File = new File('‘app-storage://data.xml’) b. Var dataFile:File = new File('‘app-storage:/data.xml’) c. Var dataFile:File = new File('‘app-storage:///data.xml’) d. None of the above 2. The following example shows a remoting service destination definition that contains source & scope properties. what does the source property point to? a. Fully qualified name of the remote server b. Fully qualified name of the remote server c. Fully qualified name of the remote server d. Fully qualified name of the remote server 3. In order to create a custom visual component in AS3, you must extend the UIComponent class. a. True b. False 4. All stylesare inherited from parent containers to their children and across style types and classes. a. True b. False 5. Which class is at the root of the AS3 class hierarchy? a. Sprite b. MovieClip c. Application d. Object 6. Metadata tags do not get compiled into executable code, but provide information to control how portions of your code get compiled. a. True b. False 7. You have utilized a List Control in your application that lists name of employees.To ensure that the employees names won’t be cut off if the

Upload: abdul

Post on 10-Apr-2015

648 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Flex Q&A

Flex, Actionscript, OOPS Questionaaire 1. Which of the following statements uses a valid URL scheme?a. Var dataFile:File = new File('‘app-storage://data.xml’)b. Var dataFile:File = new File('‘app-storage:/data.xml’)c. Var dataFile:File = new File('‘app-storage:///data.xml’)d. None of the above

2. The following example shows a remoting service destination definition that contains source & scope properties. what does the source property point to?a. Fully qualified name of the remote serverb. Fully qualified name of the remote serverc. Fully qualified name of the remote serverd. Fully qualified name of the remote server

3. In order to create a custom visual component in AS3, you must extend the UIComponent class.a. Trueb. False

4. All stylesare inherited from parent containers to their children and across style types and classes.a. Trueb. False

5. Which class is at the root of the AS3 class hierarchy?a. Spriteb. MovieClipc. Applicationd. Object

6. Metadata tags do not get compiled into executable code, but provide information to control how portions of your code get compiled.a. Trueb. False

7. You have utilized a List Control in your application that lists name of employees.To ensure that the employees names won’t be cut off if the

Page 2: Flex Q&A

length of text exceeds the width of the list row,which of the following properties of the list control must be set to ‘true’?a. variablerowHeightb. rowHeightc. verticalAlignd. wordWrap

8. Which of the following is not a valid method of the DataService object?a. Createitem()b. getItem()c. releaseItem()d. None of the above

9. Which property would you use on a Radiobutton componenet to specify the name of the RadioButtonGroup it is related to?a. groupNnameb. groupc. parentd. radioGroup

10. Which of the following url scheme would you use to store a user’s preferences file (AIR/Test/prefs.xml) that is specific to your AIR application?a. App:prefs.xmlb. File:///c:/Program%20Files/AIR Test/prefs.xmlc. app-data:/prefs.xmld. app-storage:/settings/prefs.xml

11. Which method is used to return to a bookmarked position on an IViewCursor object?a. Find()b. Seek()c. Return()d. Last()

12. Based on the following code sample,which button style will take precedence?a. The Cclass selector in the Style tagb. The Type selector in the Style tagc. The inline style on the Buttond. This button’s style will be set by the Flex default.css

Page 3: Flex Q&A

13. Which of the following flex containers always uses absolute layout?a. Applicationb. Canvasc. Paneld. None of the above

14. addItem() method from the ArrayCollection class accepts both an object and an index to where you want to add the item into the ArrayCollection:a. Trueb. False

15. It is best practice to specifically type your objects:a. Trueb. False

16. An AIR app file(.air) cannot be emailed to someone to be installed, it must be hosted.a. Trueb. False

17. The ContextMenuItem dispatches which of the following events to indicate when it is selected?a. ContextMenuEvent.SELECTb. ContextMenuEvent.MENU_SELECTc. ContextMenuEvent.SELECTEDd. ContextMenuEvent.MENU_ITEM_SELECT

18. Which of the following options are properties of the flash.display.NativeWindowType?a. NativeWindowType.LIGHTWEIGHTb. NativeWindowType.STANDARDc. NativeWindowType.TRANSPARENTd. NativeWindowType.UTILITY

19. During the layout, or update pass of the Layout Manager’s 3 stage process that determines the size & position of each component in an application, which of the following methods does the LayoutManager call

Page 4: Flex Q&A

that causes each component to layout it’s children?a. updateDisplayList()b. validateNow()c. validateSize()d. None of the above

20. Which of the following are needed in order to sort the ArrayCollection on the last name first, and first name second?a. Col.sort=sort;b. Col.refresh();c. Col.sort();d. Col.sort=sort.fields;

21. Which CSS selector type applies a style to all instances of a particular component type?An example is creating a style for all instances of the Button class.a. Inline Selectorb. Class Selectorc. Type Selectord. None of the above

22. It is considered best practice to configure your messaging service for LCDS in which file?a. Message-config.xmlb. Messages-config.xmlc. Messaging-config.xmld. services-config.xml

23. Before using the findAny(),findFirst(), and findLast(), methods of the IViewCursor class, what must be applied first on the IcollectionView implementation?a. moveNext()b. beforeFirst()c. Sort()d. Nothing else is needed to use these methods

24. Which of the following events would be used by an interactive oject to indicate visually that it can or cannot accept a drop operation?a. nativeDragEnterb. nativeDragOverc. nativeDragDrop

Page 5: Flex Q&A

d. nativeDragStart

25. Which of the following services is NOT one that you would normally use to connect flex application?a. HTTP Get or Postb. SOAP compliant web servicesc. AMFd. None of the above

26. What is design tool in Flex?

27. What is Flex?Ans: A software development kit an IDE released by Adobe Systems for the development and deployment of cross-platform rich Internet applications based on theAdobe Flash platform.

28. What is MXML?Ans: MXML is an XML-based user interface markup language Application developers use MXML in combination with ActionScript to develop Rich Internet applications, with products such as Adobe Flex. It is mainly used with Flex Server, which dynamically compiles it into standard binary SWF files.

29. Difference between Flash and Flex?

30. What is RIA?Ans: (Rich Internet Application) Fully featured software package that runs in a browser. Early generations of Internet-hosted, browser-based applications were notoriously basic compared to equivalent software that ran on a Windows or Mac desktop. This led to the evolution of RIA platforms (also known as rich client platforms), which boost the core functionality of the basic browser by temporarily downloading extra software to the client. This makes it possible to develop applications with the look and feel of a full-fledged Windows or Mac application, making them faster and more convenient to use. RIAs are distinct from 'smart clients', which require extra software pre-installed on the client machine. The leading RIA platforms today are AJAX, based on JavaScript and XML messaging, and Adobe Flex, based on Macromedia's Flash technology.

31. Components in flex?

Page 6: Flex Q&A

32. What is garbage collection?

33. Design patterns?

34. Lifecycle data services in flex?

35. Is it possible to make httpService Requests synchronous?Ans: NoBasically, what we are about to do is creating XMLHttpRequest with Javascript in Flex, and calling a server data with the parameters we will give to the object.e.g. xmlHttpRequest.open("GET","http://localhost/Default.aspx",false);1. Request Type: GET or POST2. Requested URL3. Communication Type: true for asynchronous, false for synchronous.

36. I need to load an image from flickr into my application. Do I need a Crossdomain.xml file on flickr?Ans: File is already there , we need to register our ip address to flicker’s crossdomain.xmlSince the images are located on a flickr server like farm1.static.flickr.com and there is no crossdomain.xml file on that server (there is a crossdomain.xml for api.flickr.com so you can use the api) that means you can’t get access to the bitmapData of the loaded images when you load them from flickr. This is dumb, but that’s the way it is. So you can load images just fine, but the reflection class copies the bitmapData of the image, so that doesn’t work if you load them straight from the flickr server. I also wanted to set bitmap smoothing to true on the images so the thumbnails don’t look as pixelated, and that also requires access to the bitmapData of the loaded image.So, the answer is to create a proxy that loads the flickr image so it appears to come from the same domain.

37. What is the difference between httpService and Data Service?Ans: The services-config.xml configuration file is required at compile time if the Flex application uses Flex Data Services. In the case of RPC services, this applies to all applications that use RemoteObject or proxy-based WebService or HTTPService.

38. How do you generate random numbers within a given limit with actionscript?

Page 7: Flex Q&A

39. Have you built any components with actionscript? If so explain how you did it?

40. How do you implement push on a flex applications?

41. I am going to add images into a tag. How will it resize itself?Ans: To let Flex resize the image as part of laying out your application, set the height or width properties to a percentage value. Flex attempts to resize components with percentage values for these properties to the specified percentage of their parent container.Or by default, Flex does not resize the image. The scaleContent property has a default value of true, therefore, Flex scales the image as it resizes it to fit the specified height and width. The aspect ratio is maintained by default, so the image may not completely fill the designated space. Set the scaleContent property to false to disable scaling. Set the maintainAspectRatio property to false to allow an image to fill all available space regardless of its dimensions.

42. What is a resource Manager?Ans: The ResourceManager — now handles access to all localized resources in an application. Any components that extend UIComponent, Formatter, or Validator now have a new resourceManager property, which lets you easily access the singleton instance of this manager. If you’re writing some other kind of class that needs to use the ResourceManager, you can call ResourceManager.getInstance() to get a reference to it.

43. What are the similarities between java and flex.Ans: 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).

44. What is the dynamic keyword used for?Ans: Specifies that instances of a class may possess dynamic properties added at runtime. If you use the dynamic attribute on a class, you can add properties to instances of that class at runtime. Classes that are not marked as dynamic are considered sealed, which means that properties cannot be added to instances of the class.Dynamic classes, which allow you to programmatically add new properties and behavior to classes during the run-time. Just add the magic keyword dynamic to

Page 8: Flex Q&A

the class definition:dynamic class Person { var name:String;}Now let’s add dynamically two variables name and age and the function printme() to the object of type Person:Person p= new Person();p.name=”Joe”;p.age=25;p.printMe = function () { trace (p.name, p.age);}p.printMe(); // Joe 25

45. How do you implement push with flex data services?

46. What are the methods called when a UI component is intialized?Ans: All components dispatch the following events that let you specify ActionScript to initialize a component:preInitialize : Dispatched when a component has been created in a rough state, and no children have been created.initialize : Dispatched when a component and all its children have been created, but before the component size has been determined.creationComplete : Dispatched when the component has been laid out and the component is visible (if appropriate).

47. How do you implement drag and drop on components that do not support ondrag and ondrop?

48. Can you write to the file system from flex?Ans: Yes .import flash.filesystem.*;private var stream:FileStream;private function saveFile():void{ var file:File = File.desktopDirectory.resolvePath("HelloWorld.txt"); var stream:FileStream = new FileStream() stream.open(file, FileMode.WRITE); var str:String = "Congratulations on your 1st file, Rich Tretola - EverythingFlex.com"; stream.writeUTFBytes(str); stream.close();

Page 9: Flex Q&A

mx.controls.Alert.show("File has been saved to \n" + file.nativePath, "Notice");

}

49. What is a drag manager?Ans: The Flex Drag and Drop Manager lets you select an object, such as an item in a List control, or a Flex control, such as an Image control, and then drag it over another component to add it to that component.

50. How do you call javascript from Flex?Ans: Using the ExternalInterface API to access JavaScript from Flex and Using the navigateToURL() method in Flex. The navigateToURL() method is in the flash.net packageflash.external.ExternalInterface.call(function_name:String[, arg1, ...]):Object;navigateToURL(request:URLRequest, window:String):void

51. How do you use a repeater?

52. What are three ways to skin a component in flex?Ans: Skinning is the process of changing the appearance of a component by modifying or replacing its visual elements. These elements can be made up of images, SWF files, or class files that contain drawing API methods.There are several ways that you can define skins: a. inlineb. setStyle() methodc. Cascading Style Sheets (CSS).

53. How do you use css styles in flex?Ans: External styles are defined in a separate file and can be used in any MXML file that references the CSS file. You reference a CSS file into an MXML file with the source property of the tag, as follows:Embedded styles are defined in an MXML file and can only be used in that file. Embedded styles are defined with the tag, as follows:.myclass { background-color: xFF0000 }TextInput { font-family: Helvetica; font-size: 12pt }

Page 10: Flex Q&A

Inline styles are defined in an MXML tag and can only be used in that tag.

54. What is the difference between sealed class and dynamic classes?Ans: Dynamic classes can add additional dynamic properties at runtime; sealed classes cannot.Sealed classes conserve memory because no internal hash table is needed to store dynamic properties, and the compiler can provide better error feedback.Classes are sealed by default, i.e. properties cannot be added dynamically at runtime.

55. What is MVC and how do you relate it to flex apps?Ans: The goal of the Model-View-Controller (MVC) architecture is that by creating components with a well-defined and limited scope in your application, you increase the reusability of the components and improve the maintainability of the overall system. Using the MVC architecture, you can partition your system into three categories of components:Model components : Encapsulates data and behaviors related to the data.View components : Defines your application's user interface.Controller components : Handles the data interconnectivity in your application.

56. What is state? what is the difference between states and ViewStack?Ans: The State class defines a view state, a particular view of a component. For example, a product thumbnail could have two view states; a base view state with minimal information, and a rich view state with additional information. The overrides property specifies a set of child classes to add or remove from the base view state, and properties, styles, and event handlers to set when the view state is in effect.You use the State class in the states property of Flex components. You can only specify a states property at the root of an application or a custom control, not on child controls.Difference between states and ViewStack in flex:ViewStack is to handle different MXML file eg TAB control and states is the transition within single MXML file.ViewStack should be used were there is complete change in the controls used and States should be used when you just want to add or remove a few components based on certain conditions. View States are virtual state of an existing page appearing at an instance i.e. only one state can be shown at a time while viewStack are collection of different view containers which can be shown at a time

57. How does item renderer work? How do I add item renderer at runtime?

Page 11: Flex Q&A

Ans: Each list control has a default mechanism for controlling the display of data, or view, and lets you override that default. To override the default view, you create a custom item renderer.Note: With reusable inline item renderers you use data binding to bind to the item renderer. When you use a component as an item renderer, you do not use data binding but specify the name of the custom component to use as an item renderer.Add itemrendrer at run time:Create the basic item renderer. One of the things I needed to accomplish with my item renderer was the ability to add it to different columns (ie the dataField was not always the same). This meant I needed a way from within the renderer to determine what column it was bound to so I could get and display the correct data. To do this the renderer needs to implement the IDropInListItemRenderer. This interface allows the renderer to have access to information about the list and column it is in via the BaseListData and DataGridListData classes. The DataGridListData gives you everything you need to get the data required to make a flexible, reusable renderer.To Modify itemrenderer at runtime we Need to use mx.core.ClassFactory. Basically, in order to change a Flex itemRenderer at runtime, you need to cast it to a type ClassFactory.

58. What keyword allows you to refer to private variables of a class?Ans:

• private • this

59. How polymorphism works on actionscript?Ans:class UnpaidIntern extends Employee { override public function receivePayment():Number { return 0; }}class Manager extends Employee { override public function receivePayment():Number { return baseSalary*3; }}class Engineer extends Employee { override public function receivePayment():Number { return this.baseSalary*2; }}class Employee { internal var baseSalary:Number = 1000;

Page 12: Flex Q&A

public function receivePayment():Number { return this.baseSalary; }}

60. How do you overload functions in actionscript?Ans: Method overloading using namespaces

61. What are sealed classes ?Ans: A sealed class possesses only the fixed set of properties and methods that were defined at compile-time; additional properties and methods cannot be added. This makes stricter compile-time checking possible, resulting in more robust programs.

62. What are runtime shared libraries?Ans: Macromedia Flex 1.5 you can build runtime shared libraries (RSLs) that can be individually loaded, cached, and used by multiple applications. Use Flex 3 runtime-shared-libraries (RSLs) to reduce the size of your applications and thereby reduce the time required to download the application. RSLs are just SWF files whose code is used as a shared library between different application SWF files. There are two kinds of RSLs, signed and unsigned. Signed RSLs are libraries that are signed by Adobe and may be stored in the Flash Player Cache, which can be accessed by applications from any domain. This means if your application is using a signed RSL, the RSL may not even need to be downloaded if the RSL is already in the Flash Player Cache. The signed RSL may have been put into the Flash Player Cache by visiting another web site that was using the same signed RSL. Signed RSLs have a "swz" extension.Unsigned RSLs are normal SWF files and are not loaded into the Flash Player Cache. Instead, these RSLs rely on the browser's cache to keep them from being downloaded.

63. What is Caringorm ? How do you use it? Have you worked with Caringorm ?Ans: Cairngorm is the lightweight micro-architecture for Rich Internet Applications built in Flex or AIR. A collaboration of recognized design patterns, Cairngorm exemplifies and encourages best-practices for RIA development advocated by Adobe Consulting, encourages best-practice leverage of the underlying Flex framework, while making it easier for medium to large teams of software engineers deliver medium to large scale, mission-critical Rich Internet Applications.The benefits of the Cairngorm architecture are realized when developing complex RIA applications with multiple use-cases and views, with a team of developers,

Page 13: Flex Q&A

and with a multi-disciplinary development team that includes designers as well as creative and technical developers.How is the MVC pattern carried out in a Flex + Cairngorm application?

• Model : Role of the ModelLocator & Model Objects • View : Role of View Components & Event Objects • Controller : Role of the FrontController & Command Objects

64. What keyword allows you to implement abstraction better?Ans: Flex does not support abstart class directly.

65. What design patterns have you used? in Actionscript and java?Ans:

• Creational Pattern • Factory Method Pattern • Singleton Pattern • Structural Patterns • Decorator Pattern • Adapter Pattern • Coposite Pattern • Behavioral Patterns • Command Pattern • Observer Pattern • Template Method Pattern • State Pattern • Strategy Pattern • Multiple Patterns • MVC Pattern • Symetric Proxy Pattern

66. How to display popup windows without using PopupManager class?

67. How to create and dispatch a custom event class without sub-classing any of the class hierarchies in Event class?

68. From Flash player 9 and 10, how to bypass the security sandbox settings to write into the local file system?

69. How to create custom RSL (Runtime shared library) files, i.e. We are not permitted to create swc files?

70. How to refresh the browser window using ActionScript?

Page 14: Flex Q&A

71. Explain how binding works in mxml components in flex?

72. What is the difference between ChangeWatcher.watch, and BindingUtils.bindProperty?Ans: ChangeWatcher:Acts like the watch on AS2. It watches a variable for changes and when something happens fires an event. Make sure you call the canWatch to ensure that you can watch it!There are 3 ways to specify the second parameter, the chain.A String containing the name of a public bindable property of the host object.ChangeWatcher.watch(this, "myvar", handler)An Object in the form: { name: property name, access: function(host) { return host[name] } }. The Object contains the name of a public bindable property, and a function which serves as a getter for that property.ChangeWatcher.watch(this, { name:"myvar", getter: function():String { return "something" }}, handler);A non-empty Array containing any combination of the first two options. This represents a chain of bindable properties accessible from the host. For example, to watch the property host.a.b.c, call the method as: watch(host, ["a","b","c"]BindingUtils.bindPropertyWorks pretty much the same way as the watch, but instead of having to handle and event it allows you to immediately bind two properties one-way.The first two parameters are for the the target, the second parameters are the triggers.BindingUtils.bindProperty( this, "va1", this, "var2");Note : Make sure you add the flex framework.swc to your project Library Path to have access to the mx.binding.util class.

73. Why would you want to keep a reference to a ChangeWatcher and call unwatch()?Ans: So we can reattach the watcher again & We can change the source object (of changewatcher) by reset method.The ChangeWatcher class defines utility methods that you can use with bindable Flex properties. These methods let you define an event handler that is executed whenever a bindable property is updated.unwatch() method:Detaches this ChangeWatcher instance, and its handler function, from the current host. You can use the reset() method to reattach the ChangeWatcher instance, or watch the same property or chain on a different host object.public function unwatch():void

Page 15: Flex Q&A

74. How do you add event listeners in mxml components. Now AS3 components?Ans: addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):voidremoveEventListener(type:String, listener:Function, useCapture:Boolean = false):voiddispatchEvent(event:Event):BooleanhasEventListener(type:String):BooleanwillTrigger(type:String):Boolean

75. What does calling preventDefault() on an event do? How is this enforced?Ans: 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.

76. What is the problem with calling setStyle()?Ans: Calling the setStyle() method can result in decreased performance. Use it only when necessary.You should try to apply style sheets rather than use the setStyle() method because it is computationally expensive. This method should only be used when you are changing an object's styles during run time.You cannot get or set style properties directly on a component as you can with other properties. Instead, you set style properties at run time by using the getStyle() and setStyle() ActionScript methods.

77. Explain the difference between creating an effect and setting the target as opposed to adding an effectListener?Ans: To create a behavior, you define a specific effect with a unique ID and bind it to the trigger.For example, the following code creates two zoom effects: one for shrinking the component slightly, and one for reverting it to its original size. These effects are assigned, by using their unique IDs, to the mouseDownEffect and mouseUpEffect triggers on the Button component.paddingLeft="10" paddingRight="10" autoLayout="false" left="41" top="24" right="42">mouseDownEffect="{shrink}" mouseUpEffect="{revert}"/>

Page 16: Flex Q&A

78. How do we identify a component created in a repeater using flex?Ans: If currentIndex value is greater than startIndex value means a component is created in Repeater. We can use count property to find number of children.A Repeater component executes initially when it is instantiated. If the Repeater component's dataProvider property exists, it proceeds to instantiate its children, and they instantiate their children, recursively.The Repeater component re-executes whenever its dataProvider, startingIndex, or count properties are set or modified either explicitly in ActionScript, or implicitly by data binding.When a Repeater component re-executes, it destroys any children that it previously created (assuming the recycleChildren property is set to false), and then reinstantiates its children based on the current dataProvider property.

79. Differences between defining bindings in MXML and ActionScript?Ans: There are a few differences between defining data bindings in MXML at compile time and in defining them at runtime in ActionScript:You cannot include ActionScript code in a data binding expression defined by the bindProperty() or bindSetter() method. Instead, use the bindSetter() method to specify a method to call when the binding occurs.You cannot include an E4X expression in a data binding expression defined in ActionScript.You cannot include functions or array elements in property chains in a data binding expression defined by the bindProperty() or bindSetter() method. For more information on property chains, see Working with bindable property chains.The MXML compiler has better warning and error detection support than runtime data bindings defined by the bindProperty() or bindSetter() method.

80. Can I dynamically instantiate a WebService or HTTPService in ActionScript?Ans: Flex 1.5 does not support this. First declare the tags in MXML and then manipulate the URLs, request objects, and so forth using ActionScript.

81. Can I load CSS style sheets dynamically at runtime?Ans: Dynamic loading of CSS files is not supported in Flex. CSS in Flex is processed on the server side during MXML compilation rather than on the client side at runtime. There is a trick though: A CSS file can be compiled into a separate SWF file and loaded dynamically into the application using the Loader component.

82. When I set visible="false", the component still takes up space and

Page 17: Flex Q&A

appears in the tab order. Why is that?Ans: You can often achieve the "display=none" effect by setting the height/width to zero when you set it invisible, and then set it back to a fixed value or to undefined when you make it visible again.

83. Why are my ValueObject member variables undefined in the results from my RemoteObject requests?Ans: Flash Player deserializes objects in a special order that can confuse developers used to object serialization from other RPC systems. When a strongly typed object is returned to the player, it first creates an instance from the prototype of the registered class without calling the constructor. It then populates the object with the properties sent in the result. Finally, it calls the constructor without arguments. If your ValueObject constructor expects arguments to initialize an instance, be sure to check whether arguments were actually sent to the constructor before overriding member variable values.

84. Why do strongly typed objects appear as "undefined" in the NetConnection Debugger?Ans: The NetConnection Debugger is an old utility from the early days of Flash Remoting that some developers still find useful. It has an issue, however, displaying types that have been registered with Object.registerClass(). If your Flex server is installed locally, we suggest enabling server-side "debug" level logging in /WEB-INF/flex/gateway-config.xml to watch the raw trace information in the Flex server console/logs from the AMF Gateway as it processes your RemoteObject requests.Flex Builder also includes a Network Debugger that allows you to monitor AMF traffic.

85. How do I get access to the J2EE session from my RemoteObjects?Ans: The AMF Gateway provides access to the current HttpServletRequest instance in a thread local variable. The session can be obtained from the request, as follows:flashgateway.Gateway.getHttpRequest().getSession();

86. Can I resize the Internet Explorer browser window from Flex?Ans: Use getURL() to communicate with JavaScript in the HTML wrapper:getURL('javascript:window.resizeTo(1050,900)');

87. Can Flex applications communicate with each other on the client?Ans: See the LocalConnection API in the flex documentation.

Page 18: Flex Q&A

88. Is double-clicking supported on various components?Ans: Unfortunately, double-clicking is not supported by default. If you wish to add this functionality to, say, a List or DataGrid component, you will have to add the following ActionScript 2.0 code to your application:var someTimestamp:Number;public function doubleClickHandler( evt:Object ):Void { var now = getTimer(); // we got a double-click if( ( now - someTimestamp ) < 500 ) { // do something here ... } someTimestamp = now;}

89. Why are there errors with the macromedia.css.LocatorParser class and WebLogic?Ans: WebLogic ships with its own version of the fop.jar, which in turn includes the batik.jar, which is older and breaks Flex. To resolve this issue, remove the fop.jar from the CLASSPATH in the startWebLogic.cmd file. This may apply to non-WebLogic servers as well, where batik.jar was included.

90. Sometimes, if I do not move the mouse, "click" and "mouseDown" do not work. Why is that?Ans: This is a focus issue with Flash Player; usually when the UI changes "underneath" the mouse pointer, as in a ViewStack navigation where the buttons are in the same screen location.

91. Why is myTreeNode.label or myTreeNode.attributes.label undefined?Ans: Make sure you use the TreeDataProvider methods to modify a node. Do not rely on the node being XML. For example, the above should be myTreeNode.getProperty("label") instead.

92. When I add or modify an item in my dataProvider, why does not it show up in my DataGrid?Ans: Low-level methods like Array.push() or myArray[0] = "whatever" do not cause the dataProvider's modelChanged event to fire.When you work with a dataProvider, it is always best to use the dataProvider API. In the above example, you might code: myDataProvider.addItem(myItemObject) to add an item or use editField() to modify a value programmatically.Alternatively, you can call myDataProvider.modelChanged yourself or reassign

Page 19: Flex Q&A

dataProvider to the control, as follows:myDataGrid.dataProvider = myDataProvider;

93. myTree appears just fine but why ca not I access the node attributes?Ans: Select a node in your myTree. In ActionScript, you can reference this node by using the following code: myTree.selectedNode;To access the attributes of the node, use the tree DataProvider API. These methods will work for any format dataProvider item, which might be an object, array, or XML node.The following example might work: myTree.selectedNode.attributes.myAttributeBut the following example is far more reliable:myTree.selectedNode.getProperty("myAttribute");

94. How do I pass parameters to a pop-up window in actionscript?Ans: Three different ways to pass data into a title window.It uses the initobj to pass in several built-in properties plus two user defined properties.One is a simple string, the other is a reference to the main application that can be used for binding. Note the variable that holds the application reference is typed to the name of the application. this is critical for binding to work correctly.

95. How do I run Flex as a service?Ans: Flex is not a server that you deploy and run. It is simply deployed as part of your web application. So it will work, no matter which web container you are using: Tomcat, JRun 4, WebLogic, and so forth. To learn how to deploy Tomcat, JRun 4, or any other Java server as a service, refer to the appropriate documentation for the server you are using.

96. How do I get Flex to query my database?Ans: Flex does not have any native database integration functionality. You must have your own server-side tier that provides the database-access tier and sends the data back to Flex through one of the following protocols:RemoteObjects: This is the fastest. It communicates with server-side EJBs or POJOs using AMF, a binary compressed format.HTTPService: This one uses the HTTP protocol. Sources can be JSP, ASPx, .NET, or any URL that returns HTTP.WebService: This is the slowest. It uses the SOAP protocol. Sources can be .NET or any web service.

97. I am sending my request, and I see the data traffic in the command window, but why is the result always empty?

Page 20: Flex Q&A

Ans: You are probably trying to read the result immediately after the send(), right? You're expecting synchronous behavior?

98. How do I make synchronous data calls in actionscript?Ans: You cannot make synchronous calls. You must use the result event. No, you can't use a loop, setInterval, or even doLater. This paradigm is quite aggravating at first. Take a deep breath, surrender to the inevitable, resistance is futile.There is a generic way to handle the asynchronous nature of data service calls, called ACT (Asynchronous Call Token). Search for this in the Developing Flex Applications LiveDocs for a full description.Here it is in a nutshell. This example uses HTTPService but will be similar for RemoteObject and WebService:Create a function to handle the data return, like onResult().In the HTTPService tag, put this function name in the result property and pass "event" in too.Invoke the call in the script://invokes the call to the HTTP data servicevar oRequestCallbject = app.mxdsGetData.send(oRequest);//Next, define a string to identify the call. We will use this string value in the result handler.oRequestCall.MyQueryId = "WhateverIWanttoUseToIdentifyThisCall" ;//Yes, you CAN set this AFTER you invoke send()In the result handler, which will be called every time the data service call returns, identify what the returned data contains, as follows:var callResponse = oEvent.call; //get the call object//gets the value of this property you set in the callvar sQueryId = callResponse.MyQueryId; //will be "WhateverIWanttoUseToIdentifyThisCall";trace(sQueryId); You can use the sQueryId value in a switch to do the correct processing. Alternatively, you can pass reference to a handler function directly.

99. When I have only a single record, why does not it appear in my DataGrid?Ans: This is a known issue that is caused by the inability of Flex to differentiate between an object and an array with a single row. The solution is to always use toArray(), as in the following examples:In MXML:{mx.utils.ArrayUtil.toArray(modelAccidents1.accidents.accident)}The inline format:dataProvider={mx.utils.ArrayUtil.toArray(testSrv.result.result.error)}In ActionScript:myControl.dataProvider = mx.utils.ArrayUtil.toArray(testSrv.result.result.error)

Page 21: Flex Q&A

100. Why are the columns in my DataGrid in some strange order?Ans: The order is typically the reverse of the order in which they were added. If you need a specific order, specify that and many other good things by using DataGridColumn tags.

101. Can I embed HTML in my Flex application?Ans: Flex supports a limited subset of HTML in its TextArea and some other text-related classes.

102. Which of the following is not true about AS3?a. It was introduced with the release of Flash CS3.b. It is significantly faster than previous versions of AS3.c. You can mix AS1 or AS2 code with AS3 code in the same SWF.d. AS3 has an entirely new event architecture.e. Don't knowAns: (c) You can mix AS1 or AS2 code with AS3 code in the same SWF.

103. Which of the following would you use to associate a class with your main timeline?a. FLAb. Filec. Movieclipd. Documente. Don't knowAns: (d) Document

104. Which of the following is true about AS3?a. You can write a procedural style program in AS3b. You must have an advanced knowledge of object-oriented programming to write AS3c. You must use design patterns to write AS3d. All of the abovee. Don't knowAns: (a) You can write a procedural style program in AS3

105. Is it true that AS3 is a complete rewrite of Flash's internal scripting language?a. Yesb. Noc. Don't know

Page 22: Flex Q&A

Ans: (a) Yes

106. What is scripting language standard upon which AS3 is based?a. ESPNb. XMLc. AJAXd. ECMAe. Don't knowAns: (d) ECMA

107. Which of the following symbols can be used to delineate the end of a line of code?a. :b. .c. ;d. \ne. Don't knowAns: (c) ;

108. which of the following statements is true about the Emailvalidator?a. It is used to check if the input string has exactly 1 '@' symbol and exactly 1 period.b. It is used to check if the input string has exactly 1 '@' symbol and atleast 1 period after the '@' symbol.c. It is used to check if the input string has 1 or more '@' symbols and atleast 1 period after the '@' symbol.d. It is used to check if the input string has 1 '@' symbol and exactly 1 period after the '@' symbol.

109. which of the following attributes of the event clas is defined in all types of events in flex?a. resultb. typec. idd. fault

110. from the following css style declaration, which type of style selector is being used?<mx:style> button{ font-size:30pt;

Page 23: Flex Q&A

color:#FFFFFF; }</mx:style>a. global selectorb. class selectorc. type selectord. none

111. the priotiy of the busy cursor in flex is:a. lowb. mediumc. lowAns: (a) low

112. when a text control inside the application tag using the mxml tags, it implies that:a. the text class was instantiatedb. the text class was declared but not instantiatedc. the text class was extendedd. none

113. which type of a value does the effect.target property accept?a. arrayb. stringc. numberd. xml

114. which of the following containers extends the viewstack class to provide navigation betweeen its child components?a. tabnavigatorb. accordionc. tabbard. buttonbar

115. which of the following statements about databinding is not correct?a. data binding is the process of tying the data in one object to another object.b. data binding requires a source property, a destination property and a truggering event.c. more than one source property can be bound to a destination property.d. all are correct

Page 24: Flex Q&A

116. which of the following is the correct sysntax to show the busy cursor in the UI using the CursorManager class?a. CursorManager.showBusyCursor();b. CursorManager.setBusyCursor();c. CursorManager.setCursor("busy");d. CursorManager.setCursor();Ans: (b) CursorManager.setBusyCursor();

117. which method of the ModuleLoader API is used to laod a module?a. load()b. loadModule()c. get()d. getModule()Ans: (c) loadModule()

18. which of the following can be used to access the server side data from a flex application?a. HTTPService componentb. WebService componentc. RemoteOject componentd. All of the aboveAns: (d) All of the above

119. which of the follwoing doen't accept viewstack as a dataprovider?a. TabNavigatorb. TabbBarc. ButtonBard. ToggleButtonBar

120. which protocol supports the use of server-pushed messages with the messaging and data management services in flex?a. HTTPb. RTMPc. TCPd. SMTPAns: (b) RTMP

121. what is the duration of the wipe effct mentioned below:<mx:WipeEffect id="myWipeEffect" duration="2000"/>a. 2000 seconds

Page 25: Flex Q&A

b. 2 secondsc. 200 millisecondsd. 20 millisecondsAns: (b) 2 seconds = 2000 milliseconds

122. what is the maximum number of <mx:Script> blocks that can be defined in an mxml file?a. 0b. 1c. 2d. unlimited

123. type of containers are:a. navigator and boxb. box and layoutc. layout and navigatorAns: (c) layout and navigator

124. which one is not a type of item renderera. inlineb. dropinc. dropoutd. componentAns: (c) dropout

125. According to the following CSS, what would be the font color and font size of a label?<mx:style> global{ font-size:10pt; color:#00FF00; } label{ font-size:30pt; color:#FFFFFF; }</mx:style>a. font size = 10, font color:#00FF00b. font size = 10, font color:#FFFFFFc. font size = 30, font color:#00FF00d. font size = 30, font color:#FFFFFFAns: (a) font size = 10, font color:#00FF00

Page 26: Flex Q&A

126 (a). when adding child components through view states, which is not a valid value for the 'position' property?a. firstb. firstChildc. befored. lastChild

126 (b). what would be the output?myTxt.height = 20;myTxt.width = 50;trace("explicitWidth: "+myTxt.explicitWidth)trace("explicitHeight: "+myTxt.explicitHeight)trace("width "+myTxt.width)trace("height "+myTxt.height)myTxt.percentHeight = 10;myTxt.percentWidth = 25;trace("explicitWidth "+myTxt.explicitWidth)trace("explicitHeight "+myTxt.explicitHeight)a. explicitWidth 50explicitHeight 20width 50height 20explicitWidth 50explicitHeight 50b. explicitWidth NaNexplicitHeight NaNwidth 50height 20explicitWidth NaNexplicitHeight NaNc. explicitWidth 50explicitHeight 20width 50height 20explicitWidth NaNexplicitHeight NaNd. none Ans: (a) explicitWidth 50explicitHeight 20width 50height 20explicitWidth NaNexplicitHeight NaN

Page 27: Flex Q&A

127. After invoking an HTTP service request, which property stores the returned result?a. resultb. lastResultc. valued. data

128. what does pattern letter'M' denote in the format string of DateFormatter?a. secondsb. minutesc. dayd. monthAns. (d) month

129. which of the following containers is constraint based layout supported?a. Panel with vertical layoutb. Canvasc. HBoxd. VBox

130. syntax to set the current state to the base state?a. currentState=base;b. currentState='base';c. currentState='';d. currentState='*';Ans: (c) currentState='';

131. attribute of event class stores the id of the component which generates the event?a. typeb. idc. currentTargetd. target

132. classes used by flex to implement effectsa. factoryb. event

Page 28: Flex Q&A

c. effectd. instancee. sprite

133. <mx:CurrencyFormatter id="curr" currencySymbol="Rs." precision="1" rounding="nearest"/>trace("curr "+curr.format(50750.75));a. Rs. 50,750.75b. Rs. 50750.8c. Rs. 50,750.8d. errorAns: (c) Rs.50,750.8

134. which statement is true about the view cursor?a. insert() function inserts an item at the current cursor locationb. insert() function inserts an item after the current cursor locationc. insert() function inserts an item at the end of the array collectiond. insert() function inserts an item at the 0th index of the array collection

135. correct way of setting a style property in a css file?a. fontsize=12;b. font-size=12;c. fontSize:12;d. fontsize:12;Ans: (c) fontSize:12;

136 (a). Decribes the behavior of a flex UI component?a. the behaviour of a acomponent enables us to add motion and sound to our componenet.b. the behaviour of a acomponent enables us to add animation and sound to our componenet.c. the behaviour of a acomponent enables us to add only motion to our componenet.d. the behaviour of a acomponent enables us to add motion, animation and sound to our componenet.

136 (b). method of event class used to stop bubbling of an event to its parent containers?a. terminate();b. stopPropagation();

Page 29: Flex Q&A

c. stop();d. endPropogation();

137. with which component itemrenderes can't be used?a. datagridb. canvasc. treed. tilelistAns: (b) canvas

138. which is not a valid access specifier?a. privateb. protectedc. internald. all

139. minimum version of flash player required to run AS3 is:a. 6b. 8c. 9d. 10Ans: (b) 8

140. which is not a valid AS data type:a. intb. uintc. longd. stringAns: (c) long Type was not found or was not a compile-time constant: long.

141. which class is not used to interact with the client system environment?a. applicationb. applicationDomainc. systemd. capabilities

142. kind of an error is thrown when parsing error occurs in the ASa. type errorb. syntax error

Page 30: Flex Q&A

c. argument errord. verify error

143. which class is the parent clss of all the custom event classes?a. eventb. mouseeventc. resulteventd. eventdispatcher

144. statement true for try/catch/finally is:a. try is optional but catch and finally are requiredb. catch is optional but try and finally are requiredc. finally is optional but catch and try are requiredd. all three required

145. private function addBtn():void{ var fnBtn:Button=new Button(); fnBtn.label="2 functions"; fnBtn.x=457; fnBtn.y=147; this.addChild(fnBtn); fnBtn.addEventListener(MouseEvent.CLICK, fn1); fnBtn.addEventListener(MouseEvent.CLICK, fn2);}private function fn1(evt:MouseEvent):void{ trace("FUNCTION 1")}private function fn2(evt:MouseEvent):void{ trace("FUNCTION 2")}a. fn1 called but fn2 is not calledb. fn2 called but fn1 is not calledc. either fn1 or fn2 are rendomly chooden and calledd. both fn1 and fn2 are calledAns: (d) both fn1 and fn2 are calledFUNCTION 1FUNCTION 2

146. which method of the string class returns the number of characters in a string?

Page 31: Flex Q&A

a. size()b. numChar()c. length()d. noneAns: length()

47. difference between timer and a loop is that timers are machin speed independent while loops are not.a. trueb. false

148. var xml:XML = <employeeList> <managers code="MN"> <employee id="347" code="EM"> <lastname code="LN"> zmed </lastname> <firstname code="FN"> sue </firstname> <position code="PS"> data analyst </position> </employee> <employee id="348" code="EM"> <lastname code="LN"> mcgee </lastname> <firstname code="FN"> chuck </firstname> <position code="PS"> jr. data analyst </position> </employee> </managers> <assistants code="AS"> <employee id="349" code="EM"> <lastname code="LN"> jack </lastname> <firstname code="FN"> daniel </firstname> <position code="PS"> developer </position> </employee> <employee id="350" code="EM"> <lastname code="LN"> michael </lastname> <firstname code="FN"> jones </firstname> <position code="PS"> developer </position> </employee> </assistants></employeeList>trace(xml.employee.*.@*)a. An XMLList that includes every attribute defined on the employee tag, its parent and all descendantsb. An XMLList that includes every attribute defined on the employee parent tag and all descendants tags

Page 32: Flex Q&A

c. An XMLList that includes every attribute defined on the employee tags descendants but not on the employee tagd. An XMLList that includes every attribute defined on the employee tag and all its descendants

149. compiled output of an AS file is:a. classb. swfc. asd. mxmlAns: (b) swf

150. which of the conditions must be true to facilitate the usage of seek() function of an Array Collections cursor?a. the array collection must contain only similar data typesb. the array collection must be storedc. the array collection should have more than 278 objectsd. none

151. var str1:String="kanu"var str2:String="kukreja"which statement will give the result "kanukukreja"a. str1 + str2b. str2.concat(str1, str2)c. str1.concat(str1, str2)d. str1.concat(str2)e. str2.concat(str1)Ans: (a)str1 + str2 = kanukukreja(d)str1.concat(str1, str2) = kanukukrejaresult of rest:(b)kukrejakanukukreja(c)kanukanukukreja(e)kukrejakanu

152. nature of AS is depicted by the use of events?a. synchronousb. asynchronousc. procedure orientedd. object oriented

Page 33: Flex Q&A

153. addEventListner() method of EventDispatcher class is used to:a. create a new eventb. delete an eventc. add/register a new listener for an eventd. deregister an event listener

154. var num:Number = 23;convert it into string using:a. num.toString()b. num.toSentence()c. num.toWord()d. num.toNumber() Ans: (a) 23for rest all - TypeError: Error #1006: value is not a function.

155. e4x in AS is used to:a. manipulate complex numeric datab. manipulate string datac. manipulate string and numeric datad. manipulate xml data

156. which method of XML object class can be used to add a new node to XML object?a. addNode()b. appendNode()c. addChild()d. appendChild()e. prependChild()

157. choose correct syntax:i. public function fn():*;ii. public function fn():void;iii. public function fn():String;

a. i & ii validb. ii & iii validc. i & iii validd. all validAns: (d) all valid

Page 34: Flex Q&A

158. suppose we have an array collection whose cursor(myCursor) has been created using the arraycollections getCursor() metod.At runtime, when myCursor.afterLast returns true, what is the value of myCursor.current?a. nullb. a refrence to the last item in the array collectionc. a refrence to the first item in the array collectiond. a refrence to any random item in the array collection

159. source of arrayCollection is of the type:a. ArrayCollectionb. intc. stringd. arrayAns: (d) Array

160. which is not a valid quantifier metacharacter used in regular expressionsa. +b. -c. *d. ?

161. which loop structure are used to access dynamic instance variables of an object?a. whileb. do-whilec. ford. for-each-in

162. var n1:String="hello"var n2:String="hello"if (n1 === n2){ trace("equal")}else{ trace("unequal")}a. equalb. unequalc. ""

Page 35: Flex Q&A

d. compilation error: syntax errorAns: (a) equal

163. trim() method of stringutil class is used:a. only to remove all white spaces from the beginning of the string b. only to remove all white spaces from the end of the stringc. to remove all white spaces from the beginning and end of the stringd. to remove all white spaces in the string including those inside the string

164. default max size of shared objects?a. 10KBb. 100Kbc. 500KBd. 1MB

165. protected type variable is accessible in;a. all child classes irrespective of the packageb. only child classes in the same packagec. only child classes outside the current packaged. not accessible in any of the child classes

166. keyword used to bring control out of a loopa. breakb. continuec. endd. terminate

167. which can not be passed to a function?a. arrayb. class objectc. reference variabled. header file

168. which of the following is a benefit derived from using OOPS?a. elimination of redundant codeb. reusing the codec. ability to enhance and extend previously written code for new modulesd. co-existence of multiple instances of objectse. all

Page 36: Flex Q&A

169. two functions are defined with the same name and same return type.the first one accepts string input parameter type and the second one accepts integer.Is this represents abstraction?a. trueb. false

170. operator overloading is:a. an operator exhibits same behavior in different situationsb. an operator exhibits different behavior in different situationsc. an operator exhibits ambigious behavior in different situationsd. an operator exhibits different behavior in same situations

171. Two classes "Baz" and "Sasa" are used in "Commune" class. which represents a correct relation between the 2?a. commune hasa sasab. sasa hasa communec. commune hasa bazd. baz hasa commune

172. which is not an object oriented programming language?a. eiffelb. javac. small talkd. visual basic

173. encapsulation is:a. wrapping functions in to a single unitb. wrapping functions and data in to a single unit c. making the whole data accessible to the outer worldd. making the whole data and functions accessible to the outer world

174. unknown type of inheritance is:a. singleb. multiplec. hierarchicald. ternarye. multilevel

175. how much memory does a function use up with in an object?

Page 37: Flex Q&A

a. 2 bytesb. 8 bytesc. 16 byesd. 0 byte

176. which is invalid for an inline function?a. it saves the overhead of calling functionb. it must contain only a few lines of codec. it allows recursiond. it should not contain static variables

177. starting point for program execution in C++/javaa. user defined functionb. mainc. first function defined in classd. none

178. you have 3 classes A, B & C. B is derived from A and C is derived from B. which of the following relations are correct for the given classes?a. A isa Bb. B isa Ac. C isa Bd. B isa C

179. which is a incorrect statement with regard to procedural languagea. large programs are divided in to functinsb. data moves around openly from one function to anotherc. data is emphasized over procedured. it uses top-down program design approach

180. data hiding is:a. insulating data from being accessed by the programb. insulating data from being accessed by the program directlyc. insulating data from being accessed by the members directlyd. none

181. Is it possible to call a main() inside another main() function in c++?a. trueb. false

Page 38: Flex Q&A

182. what does the following classes represent?A --> B --> C --> Da. multiple inheritanceb. hybrid inheritancec. multi-level inheritanced. multi-class inheritance

183. In a public derivation, the accessibility of base class members gets changed in the derived class. How is it representated?a. public --> protectedb. protected --> protectedc. public --> publicd. protected --> private

184. function overloading is based upon the numbr and/or type of arguments passeda. trueb. false

185. which one is the "intermediate base class" with regard to the following:class A --> class B(derived) --> class C(derived)a. class Ab. class Bc. class Cd. class B & class C

186. which can not apply to constructors?a. name same as class nameb. void return typec. can have parametersd. overloading

187. which is not a procedural language?a. Cb. fortranc. small talkd. cobol

Page 39: Flex Q&A

188. which is correct with regard to prototype based programming?a. it is a mean of achieving object-oriented behavior sharingb. in prototyping a similar object can be defined by referring to the original one as a template and then listing how the new object differs from the original onec. JS is a common example of prototyping modeld. none

189. object based programing languages do not support inheritance and dynamic bindinga. trueb. false

190. the dynamic binding is the linking of a procedure call with the code to be executed at runtimea. trueb. false

191. which describes function overloadinga. same number of parameters, differnt parameter data typeb. same type of parameters, differnt function namec. same function name, different order of parametersd. same name of parameters, differnt return type

192. which does not constitute the classes relationship?a. isab. is_part_ofc. hasad. has_partse. usage

193. how many times can classes be nested with in a class?a. 5b. 8c. 4d. unlimited

194. which is incorrect with regard to operator overloading?a. it can be overlaoded many times using ditinct signaturesb. it can be called compile time polymorphism c. it can be static or protected

Page 40: Flex Q&A

d. it must have at least one user defined type

195. first object oriented programming languagea. Adab. smalltalkc. c++d. simulad. boo

196. shared/static method is associated with a classa. trueb. false

197. which is correct with regard to polymorphisma. process by which a class cn exist in multiple formsb. process by which a class cn exist only in 2 formsc. process by which different instances of an object displays diferent behaviord. process by which different instances of an object displays similar behavior

198. which is not a computing model for OOP language and systems?a. imperative modelb. actor modelc. simpson modeld. logical modele. functional model

199. which is incorrect with regard to virtual functiona. it can be friend of any other classb. it implements early bindingc. prototype of function in base and derived class must be identicald. it implements polymorphism

200. which is correct with regard to static variablea. it can be initialized onceb. it is priviliged to get initialized firstc. its value cannot be changedd. it holds its value when recalled

Page 41: Flex Q&A

201. Inheritance is a process by which the objects of parent class acquire th properties of child classa. trueb. false

202. what is an object in object oriented programminga. a real entity having some stateb. a real entity having state & behaviorc. an entity having some stated. an entity having state & behavior

203. Types of BindingAns:

• Using the curly braces ({}) syntax • Using ActionScript expressions in curly braces • Using the tag in MXML • Using bindings in ActionScript(BindingUtils)

204. How to create your own eventAns:

• Creating a subclass from the Event class • Using the Event metadata tag • Dispatching an event

205. Event BubblingAns: The mechanism through which event objects are passed from the objects that generates an event up through the containership hierarchy

206. Life cycle of Flex Application/Component?Ans: Preinitialize: The application has been instantiated but has not yet created any child components.Initialize: The application has created child components but has not yet laid out those components.creationComplete: The application has been completely instantiated and has laid out all components

207. How you implement MVC in your ApplicationAns: Cairngorm is based on the MVC model. It is specifically designed to facilitate complex state and data synchronization between the client and the server, while keeping the programming of the View layer detached from the data implementation.The role of the View layer in a Cairngorm application is to throw events and bind to data stored in the Model. Components on the View can bind to Value Objects or other properties in the Model (data) layer.

Page 42: Flex Q&A

In a Cairngorm Model, related data are stored in Value Objects (VOs), while simple variables can be stored as direct properties of the ModelLocator class. A static reference to the ModelLocator singleton instance is used by the View layers to locate the required data.The Controller is the most sophisticated part of the Cairngorm architecture. The Controller layer is implemented as a singleton FrontController. The FrontController instance, which receives every View-generated event, dispatches the events to the assigned Command class based on the event's declared type.The Command class then processes the event by running the Command class' execute() method, which is an ICommand interface method. The event object may include additional data if required by the developer. The execute() method can update the central Model, as well as invoke a Service class which typically involves communication with a remote server. The IResponder interface, which is also implemented by the Command class, includes onResult and onFault methods to handle responses returned from the invoked remote service.

208. Difference btw Java and Flex Getters SettersAns: When it comes to getters and setters, Java and AS are quite different, in that getters and setters are part of the core ECMAScript language, whereas in Java, getters and setters are done through a naming convention.In Java, it is almost never a good idea to make member variables public. If you do decide to make member variables public and then later want to change the interface to use getter/setter functions, you will have to modify all callers of your interfaces, which is onerous at best and in many cases, not possible (expecially when you are creating code that is used by other people).Meanwhile, in ECMAScript, the externally visible interface doesn’t change when I go from a member variable to a getter/setter and back again. In some sense, the interface hiding is already accomplished in the language. Creating public member variables is “safe” in this sense.Perhaps this is already obvious to all the AS-heads out there, but it took me a bit of time to get used to the concept.

209. How many events are fired when your focus goes in one text box, you enter some text and then press tab.Ans:

• PreinitializeHandler() • initializeHandler() • itemEditBegin • itemEditEnd • creationComplete()

210. How you use styles different ways of using Style sheetAns:

• Using external style sheets • Using local style definitions • Using the StyleManager class

Page 43: Flex Q&A

• Using the setStyle() and getStyle() methods • Using inline stylesLoading style sheets at run time

211. How can you use two Styles at the same timeAns:

• Using external style sheets • use Inline style commands

212. Try to remember properties of few imp componentsAns:< id="WeatherService" wsdl="http:/example.com/ws/WeatherService?wsdl" useproxy="false">< !-- Bind the value of the ZIP code entered in the TextInput control to the ZipCode parameter of the GetWeather operation. -->< name="GetWeather"><>{zip.text}< /mx:request>< /mx:operation>

213. What is the difference between Flex 2.0 and Flex 3.0Ans: 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

Page 44: Flex Q&A

• CS3 Suite integration • CSS Outline • CSS Design View • Flex 3 SDK Skinning/Style Enhancements

214 (a). How will you call Java method from Flex?Ans: Using RemoteObject. Explain the process to interviewer

214 (b). What are the config files used for connecting Java and Flex?Ans:

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

214 (c). What are the channels and their typesAns: The Channel class is the base message channel class that all channels in the messaging system must extend.Channels are specific protocol-based conduits for messages sent between MessageAgents and remote destinations. Preconfigured channels are obtained within the framework using the ServerConfig.getChannel() method. You can create a Channel directly using the new operator and add it to a ChannelSet directlyIn Flex AMFChannel is used mostly. Action Message FormatMethods

• applySettings () • connect() • connectFailed() • connectSuccess() • connectTimeoutHandler() • disconnect() • disconnectFailed() • disconnectSuccess() • flexClientWaitHandler() • getMessageResponder() • internalConnect()

Page 45: Flex Q&A

• internalDisconnect() • internalSend() • logout() • send() • setCredentials()

Properties

• authenticated • channelSets • connected • connectTimeout • endpoint • failoverURIs • protocol • reconnecting • recordMessageSizes • recordMessageTimes • requestTimeout • uri

215. Give the name of Collection which can be mapped to java and Flex and vice-versaAns: java.lang.String Stringjava.lang.Boolean, boolean Booleanjava.lang.Integer, int intjava.lang.Short, short intjava.lang.Byte, byte[] intjava.lang.Byte[] flash.utils.ByteArrayjava.lang.Double, double Numberjava.lang.Long, long Numberjava.lang.Float, float Numberjava.lang.Character, char Stringjava.lang.Character[], char[] Stringjava. math.BigInteger Stringjava.math.BigDecimal Stringjava.util.Calendar Datejava.util.Date Datejava.util.Collection mx.collections.ArrayCollection(for example, java.util.ArrayList)java.lang.Object[] Arrayjava.util.Map Object (untyped). For example, a java.util.Map[] is converted to an array (of objects).java.util.Dictionary Object (untyped)org.w3c.dom.Document XML objectjava.lang.Object (other than previously listed types) Typed ObjectObjects are serialized by using JavaBean introspection rules and also include public fields. Fields that are static, transient, or nonpublic, as well as bean properties that are nonpublic or static, are excluded.

Page 46: Flex Q&A

216. How can you call JavaScript from MXMLAns: IExternalInterface.call()

217. How can you access a var defined in 1 MXML flex in to another MXML fileAns: Create 1 object of MXML fiel into another MXML File

218. Is it possible to make httpService Requests synchronous?Ans: var mytoken:AsyncToken = yourservice.send();mytoken.addResponder(new ItemResponder(function,errorFunction));ORYou can create a result handler to your HTTPService.remoteObjectName.Your methodname.addEventListener("result",HandlerFunction,false,0,true);

219. I need to load an image from flickr into my application. Do I need a crossdomain.xml file on flickr?Ans: every SWF file you view runs locally on your machine. This means that a SWF would have HTTP access to all machines behind the company firewall. To prevent this, every server other than the one the SWF is loaded from, needs to have a crossdomain.xml file in its root, listing all domains that have access to that particular server

220. What is the difference between httpService and Data Service?Ans: Basically, Flex allows three types of RPC services:

• HttpService • WebServices • 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.

221. How do you generate random numbers within a given limit with actionscript?Ans: var randNum:Number = Math.random()*100;

222. Have you built any components with actionscript? If so explain how you did it?Ans:package myComponents{ import mx.controls.Button;

Page 47: Flex Q&A

public class MyButton extends Button { public function MyButton() { super(); label="Submit"; } }}

223. How do you implement push on a flex applications?Ans: Messaging systems let separate applications communicate asynchronously as peers by passing packets of data called messages back and forth through a Message Service. A message usually consists of a header and a body. The header contains an identifier and routing information. The body contains application data.So, you will be building an application that allows you to asynchronously send data through the DS message service to our Flex client application. Here are some key DS messaging terms:Producer: Producers are applications that create/send messages to the destination.Consumer: Consumers are applications that receive messages from the destination.Message Destination: Destinations are the resources used for both publish-subscribe and point-to-point messaging.Message Channel: The channel is the method for connecting producers and consumers to the destination (using an endpoint).Message Endpoint: An endpoint is the interface responsible for encoding and decoding data into messages.Message Adaptor: The adaptor defines the messaging implementation. Options include using the ActionScriptAdapter provided with DS, or an external Java Message Service (JMS) provider.

224. I am going to add images into a tag. How will it resize itself?

225. What is a resource Manager??

226. What are the similarities between java and flex?

227. What is the dynamic keyword used for?

228. How do you implement push with flex data services?

229. What are the methods called when a UI component is intialized?

230. How do you implement drag and drop on components that do not support ondrag and ondrop?

231. Can you write to the file system from flex?

Page 48: Flex Q&A

232. What is a drag manager?Ans: Manages the drag-and-drop operations; for example, its doDrag() method starts the drag operation.

233. How do you call javascript from Flex?Ans: flash.external.ExternalInterface.call(function_name: String[, arg1, ...]):Object;

234. How do you use a repeater?Ans:< id="rp" dataprovider="{dp}">< height="49" width="50" click="Alert.show(String (event.currentTarget.getRepeaterItem()) + ' pressed')" label="{String (rp.currentItem)}">< /mx:repeater>

235. What are three ways to skin a component in flex?Ans: Graphical skins: Images that define the appearance of the skin. These images can JPEG, GIF, or PNG files, or they can be symbols embedded in SWF files. Typically you use drawing software such as Adobe PhotoShop or Adobe Illustrator to create graphical skins.Programmatic skins: ActionScript or MXML classes that define a skin. To change the appearance of controls that use programmatic skins, you edit an ActionScript or MXML file. You can use a single class to define multiple skins.Stateful skins: A type of programmatic skin that uses view states, where each view state corresponds to a state of the component.The definition of the view state controls the look of the skin. Since you can have multiple view states in a component, you can use a single component to define multiple skins.

236. How do you use css styles in flex?Ans:

• Using external style sheets • Using local style definitions • Using the StyleManager class • Using the setStyle() and getStyle() methods • Using inline stylesLoading style sheets at run time.

237. What is the difference between sealed class and dynamic classes?Ans: Sealed Classes: ActionScript 3.0 introduces the concept of sealed classes. A sealed class possesses only the fixed set of properties and methods that were defined at compile time; additional properties and methods cannot be added. This enables stricter compile-time checking, resulting in more robust programs. It also improves memory usage by not requiring an internal hash table for each object instance. Dynamic classes are also possible using the dynamic keyword. All classes in ActionScript 3.0 are sealed by default, but can be declared to be

Page 49: Flex Q&A

dynamic with the dynamic keyword.Dynamic classes A dynamic class defines an object that can be altered at run time by adding or changing properties and methods. 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.dynamic class Protean{ //Use dynamic keyword before the name of class}

238. What is e4X and XML?Ans: E4X means "ECMAScript For XMLUsing E4X, we can develop code with XML data faster than was possible with previous programming techniques. E4X provides a set of classes and functionality for working with XML data. ActionScript 3.0 includes the following E4X classes: XML, XMLList, QName, and Namespace.Here is an example of manipulating data with E4X:var myXML:XML =<>< id="'1'"><>burger<>3.95< /item>< id="'2'"><>fries<>1.45< /item>< /order>trace (myXML.item[0].menuName); // Output: burgertrace (myXML.item.(@id==2).menuName); // Output: friestrace (myXML.item.(menuName=="burger").price); // Output: 3.95

239. What is state? What is the difference between states and ViewStack?Ans: View Stack is to handle different MXML file eg TAB control, and states is the transition within single MXML file

240. How does item renderer work? How do I add item renderer at runtime?

241. What keyword allows you to refer to private variables of a class?

242. How polymorphism works on actionscript?

243.. How do you overload functions in actionscript?

Page 50: Flex Q&A

244. What is dynamic keyword used for?Ans: Those Classes which should be extended and changed are called Dynamic classes

245. What are sealed classes?Ans: Classes whichyou cant extend. ex String

246. What are runtime shared libraries?

247. What is caringhorm? How do you use it? Have you worked with Cairngorms?

248. What keyword allows you to implement abstraction better?

249. What design patterns have you used? In Actionscript and java?

250. What's the difference between Java and AS3 getters and setters? Ans: I have to explicitly call a setter/getter function in Java, while AS3 allows me to Access my setters and getters as though they are variables.

251. Explain the component lifecycle.

252. Tell me about dataServices

253. understanding of MVC

254. They ask what frameworks you aree familiar with When getting developers to help create "standard" application, I'd weight a lot more heavily on the as3 questions. Aside from basic "show me how you'd write X" algorithm questions, you can ask more in depth ones about the workings of the language:

255. Explain how binding works in mxml components.

256. Explain the ChangeWatcher.Wach()Ans: You can detect when a binding occurs in your application. Flex includes the mx.binding.utils.ChangeWatcher class that you can use to define a watcher for a data binding. Typically, your event watcher invokes an event listener when the binding occurs

257. Why would you want to keep a reference to a ChangeWatcher and

Page 51: Flex Q&A

call unwatch()?

258. How do you add event listeners in mxml components. Now AS3 components?

259. What does calling preventDefault() on an event do? How is this enforced?Ans: Prevent defaults helps skipping the default behaviour or any componnent. Like in radio Button when you will click it will get selected, but if you want only the skin to be changed you can use preventDefault()

260. (If applicable) Explain the lifecycle of a Cairngorm action.

261. I was interviewed for a Flex position. The hiring manager kept on asking Java and J2EE questions. So, I asked him politely: you are hiring me for a flex position, why do you keep on asking Java questions?

262. What are some ways to specify styles on components?

Q 63. What is the problem with calling setStyle()Ans: When you are instantiating an object and setting the styles for the first time, you should try to apply style sheets rather than use the setStyle() method because it is computationally expensive. This method should only be used when you are changing an object's styles during run time

264. Explain the difference between creating an effect and setting the target as opposed to adding an effectListener

265. What do repeater components do?

266. How do you identify a component created in a repeater?

267. What is state? What is the difference between states and ViewStack? Ans: View Stack is to handle different MXML file eg TAB control.And states is the transition within single MXML file ViewStack should be used where there is complete change in the controls used and States should be used when you just want to add or remove afew components based on certain conditions. Login/Registration/Forgot password is the best example for using States as each page will either add or remove to the already existing one.

Page 52: Flex Q&A

268. What is the difference between httpService and Data Service? Ans. The Flex presentation layer communicates with the business layer by using Flex data services, which are objects you insert in a Flex file. Specifically, you can use Flex data services to interact with the following:* Web services* HTTP services* Remote objectsA Flex data service is an object you insert in an MXML file to communicate with the business layer of a multi-tier application. You 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.

269. Why you don’t Embed all images in your applicationAns: That increases the size of the SWF File

270. What type of images can be loadedAns: (PNG, GIF, JPEG, SWF at run time and PNG, GIF, JPEG, SWF, SVG at compile time)

271. Explain ContainerCreationPolicyAns: This is used with the containers like Accordian, ViewStack etc. depending upon the ContainerCreationPolicy you have set accordingly the child pages will be loaded.ALL Immediately create all descendants.AUTO: Delay creating some or all descendants until they are needed.NONE: Do not create any children.QUEUED: Add the container to a creation queue.

272. What are the factory classesAns: Factory class The factory class creates an object of the instance class to perform the effect on the target. You create a factory class instance in your application, and configure it with the necessary properties to control the effect, such as the zoom size or effect duration.

273. Explain MetadataAns: You insert metadata tags into your MXML and ActionScript files to provide information to the Adobe Flex compiler. Metadata tags do not get compiled into executable code, but provide information to control how portions of your code get compiled.

274. I was asked too many questions on the event bubbling, Like how to capture and event if the component is disabled.Ans: addEventListner on the parents and enable the component in that handler

Page 53: Flex Q&A

275. obj.addEventListener(MouseEvent.CLICK, MouseClickHAndler); in this obj should inherit which class?Ans: DispatchEventYou can manually dispatch events using a component instance's dispatchEvent() method. All components that extend UIComponent have this methodobjectInstance.dispatchEvent(event:Event):Boolean

276. Why we extent Sprite Class in our Graphical Classes?

277.What is Layout Manager and explain the Properties and Methods?Ans. The LayoutManager is the engine behind Flex's measurement and layout strategy. Layout is performed in three phases; commit, measurement, and layout.The commit phase begins with a call to validateProperties(), which walks through a list (sorted by nesting level) of objects calling each object's validateProperties()method.The objects in the list are processed by nesting order, with the most deeply nested object accessed first. This can also be referred to as bottom-up inside-out ordering.The measurement phase begins with a call to validateSize(), which walks through a list (sorted by nesting level) of objects calling each object's validateSize() method to determine if the object has changed in size.The layout phase begins with a call to the validateDisplayList() method, which walks through a list (reverse sorted by nesting level) of objects calling each object's validateDisplayList() method to request the object to size and position all components contained within it (i.e. its children).Property of LayoutManagerusePhasedInstantiation : Boolean A flag that indicates whether the LayoutManager allows screen updates between phases.

278.How do you call a method in particular ItemRenderer. Also the ItemRenderer is your own Custom Component.Ans<>< id="comboBox" dataprovider="{statesXMLList}" labelfield="@name" itemrenderer="ComboBoxItemRenderer">< /mx:Application>View ComboBoxItemRenderer.mxml< ?xml version="1.0" encoding="utf-8"?>< mx="http://www.adobe.com/2006/mxml" stylename="plain">< text="{data.@name}" onclick="MyOwnMethodThatIWantToCall()">< /mx:VBox>

279. How can you implement Singleton in Flex Application?Ans: If you are a Java Programmer dont be mistaken by saying create Private

Page 54: Flex Q&A

Constructor. We cant create private Constructor in Flex.

280. Give similiarities btw Java and FlexAns: Both are object Oriented, Encapsulation, Inheritance, Abstraction and Polymorphism are implemeted in both of the technologies.*The package like imports*Availability of Classes in the scripting language*Capabilities Arrays & ArrayCollections*On the UI end, similarities to SWING