Sunday, May 25, 2014

20 TOP Flex Interview Questions and Answers pdf

Most frequently Asked Flex Interview Questions and Answers for freshers and experienced pdf free download

1. Is it possible to make httpService Requests synchronous in adobe flex?
No.
Basically, 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.
1. Request Type: GET or POST
2. Requested URL
3. Communication Type: true for asynchronous, false for synchronous.

2. I need to load an image from flickr into my application. Do I need a crossdomain.xml file on flickr?
File is already there, we need to register our ip address to flicker’s crossdomain.xml Since 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 fiickr. 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.

3. What is the difference between httpService and Data Service?
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.

4. how do you generate random numbers within a given limit with actionscript?
Math.round(Math.random() * (high - low)) + low

5. Have you built any components with actionscript? If so explain how you did it?
CountryComboBox.as
package components
{import mx.controls.ComboBox;
public class CountryComboBox extends ComboBox
{public function CountryComboBox()

{dataProvider = [“United States”, “United Kingdom’];
}

}
}
<‘xml version=” 1.0” encoding=”uff-8”?>
<mx: Application
xmlns:mx=’http://www.adobe.com/2006/mxml”
xmlns:custom=”components.*”
width=”220” height=”l 1 5” >
<custom:CountryComboBox />
</mx:Application>

6. how do you implement push on a flex applications?
Using BlazeDS Server, LiveCycle Data Services

7. I am going to add images into a tag. How will it resize itself in adobe flex actionscript?
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.

8. What is a Resource Manager in flex actionscript?
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.getlnstance() to get a reference to it.

9. What are the similarities between java and flex?
Both can be used as client application, both have packages, OOP based ,support XML, import external packages, up casting, support Array Collection ,almost same primitive data types, both support class library packaging( jar, .swc).

10. What is the dynamic keyword used for in flex actionscript?
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.

11. how do you implement push with flex data services?
Using Blaze DS Server& LCDS

12. What are the methods called when a UI component is initialized?
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.
Creation Complete
Dispatched when the component has been laid out and the component is visible (if appropriate).

13. Can you write to the file system from flex?
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();
mx.controls.Alert.show(”File has been saved to \n” + file.nativePath, “Notice”);

14. What is a drag manager in adobe flex actionscript?
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

15. How do we call javascript from Flex actionscript?
Using the Externalinterface APT to access JavaScript from Flex and Using the navigateToURL() method in Flex. The navigateToURL() method is in the flash.net package
flash.external.ExtemalInterface. call(function_name:String[, arg1, ..]) Object; navigateToURL(request:URLRequest, window:String):void

16. how do you use a repeater in actionscript?
<mx:Application>
<mx:Script>
<![CDATA[
[Bindable]
public var myArray:Array[ 1,2,3,4];
]]>
</mx: Script>
<mx:Panel tiile=”Repeater: emulating a for loop” paddingBottom=” 10” paddingLeft=” 10” paddingRight=” 10” paddingTop=” 10”>
<mx:Repeater id=”myRep” dataProvider=” {myArray }“>
<mx:Label id=”myLabel” text=”This is loop# {myRep.currentIndex}”/>
</mx: Repeater>
</mx:Panel>
</mx: Application>

17. what are three ways to skin a component in flex?
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: inline, by using the setStyle() method, and by using Cascading Style Sheets (CSS).

18. how do we use css styles in flex?
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 <mx:Style> tag, as follows:
<mx:Style source=”. ./siteStyles.css”/>
Embedded styles are defined in an MXML file and can only be used in that file. Embedded styles are defined with the <mx:Style> tag, as follows:
<mx:Style>
.myclass { background-color: xFF0000}
TextInput{ font-family: Helvetica; font-size: 12pt}
</mx:Style>
<mx :Canvas>
<mx:Button  styleName=”myclass”>
</mx:Canvas>
Inline styles are defined in an MXML tag and can only be used in that tag. Inline styles are defined as follows:
<mx:Button color=”red’...>
<mx:TextInput fontFamily=”Helvetica” fontSize=” 12”..>

19. What is the difference between sealed class and dynamic classes in flex?
Classes are sealed by default, i.e. properties cannot be added dynamically at runtime.
* 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.

20. What is MVC and how do you relate it to flex apps?
(Separation of concerns) 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.

No comments: