Pages

40 Latest Adobe Flex Actionscript Interview Questions with Answers

1. 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.

2. Explain What is the function of trace?
A. Initiate the automatic debugging procedure.
B. Discover who has downloaded your movie.
C. Send String Values to the output panel.
D. Determine what objects are presents on stage ant any one time.

3. What are the correct statements consenting text field?
A. Embedded font outlines are shared by text fields using the same font.
B. Font Outlines for static for static text field are embedded in the SWF file by default.
C. Font outline for input text field are embedded in SWF file by default.
D. Individual font outlines are embedded in to the SWF file for each text field in the FLA file.
E. Font outlines for dynamic text fields are embedded in SWF file by default.

4. Explain How many levels does Flash MX support?
A. 20
B. 80
C. 100
D. 1000

5. Explain What happens if an .swf is loaded into a already occupied level?
A. An error is thrown.
B. The new swf is rejected and the old one stays.
C. The old swf is unloaded and the new swf is loaded.
D. They share the same level

6. Explain What happens if an .swf is loaded into a already occupied level?
A. An error is thrown.
B. The new swf is rejected and the old one stays.
C. The old swf is unloaded and the new swf is loaded.
D. They share the same level

7. Explain Which of the following is the recommended character to use to separate target level paths levels?
A. / (slash)
B. $ (Dollar sign)
C. _ (underscore)
D. % (percentage sign)

8. What is default frame rate of the timeline in frame per second?
A. 1
B. 12
C. 24
D. 30

9. What Is Interface or Benefit of Interface in term of OOP?
► Allows you to specify a set of methods that
classes are required to implement

► Classes can implement multiple interfaces,
interfaces can extend each-other

► Interfaces can be seen as contracts to be
developed against, great for frameworks

10. What is Display container?
Display object container is special type of display object which can contain child display objects in addition to (generally) having its own visual representation. When a display object container is removed from the display list, all its children are removed as well.

Adobe Flex Actionscript Interview Questions with Answers

11. What is Display object?
Display object is an object which represents some type of visual content in Flash Player. Only display objects can be included in the display list, and all display object classes are subclasses of the DisplayObject class. After a display object is created, it won't appear on-screen until it is added into a display object container.

12. What is Display list?
Display list is hierarchy of display objects that will be rendered as visible screen content by Flash Player. The Stage is the root of the display list, and all the display objects that are attached to the Stage or one of its children form the display list (even if the object isn't actually rendered, for example if it's outside the boundaries of the Stage).

13. What Is the Model-View-Controller (MVC) Pattern?
The Model-View-Controller (MVC) is a compound pattern, or multiple patterns working together to create complexapplications.
► Model Contains the application data and logic to manage the state of the application
► View Presents the user interface and the state of the application onscreen
► Controller Handles user input to change the state of the application

14. What is Polymorphism in term of OOP (Flash Actionscript)?
Inheritance also allows you to take advantage of polymorphism in your code. Polymorphism is the ability to use a single method name for a method that behaves differently when applied to different data types.

15. What is Inheritance in term of OOP (Flash Actionscript)?
Inheritance is a form of code reuse that allows programmers to develop new classes that are based on existing classes. The existing classes are often referred to as base classes or superclasses, while the new classes are usually called subclasses. Advantage of inheritance is that it allows you to reuse code from a base class. Use the extends keyword to indicate that a class inherits from another class.

16. What is Interface in term of OOP (Flash Actionscript)?
An interface is a collection of method declarations that allows unrelated objects to communicate with one another. The structure of an interface definition is similar to that of a class definition, except that an interface can contain only methods with no method bodies. Interfaces cannot include variables or constants but can include getters and setters. To define an interface, use the interface keyword. Use the implements keyword in a class declaration to implement one or more interfaces.

17. What is different between URLLoader class and Loader class?
The URLLoader class downloads data from a URL as text, binary data, or URL-encoded variables. It is useful for downloading text files, XML, or other information to be used in a dynamic, data-driven application. A URLLoader object downloads all of the data from a URL before making it available to ActionScript. It sends out notifications about the progress of the download, which you can monitor through the bytesLoaded and bytesTotal properties, as well as through dispatched events.

The Loader class is used to load SWF files or image (JPG, PNG, or GIF) files. Use the load() method to initiate loading. The loaded display object is added as a child of the Loader object.

18. Tell some new capabilities / Features of Flash AS 3.0?
► URLLoader class to load text or binary data (The ActionScript 2.0 MovieClipLoader and LoadVars classes are not used in ActionScript 3.0. The Loader and URLLoader classes replace them.)

► Sound.computeSpectrum() (Takes a snapshot of the current sound wave and places it into the specified ByteArray object. It returns a ByteArray containing 512 normalized values (-1 to 1) that can be used to visually display the waveform of sound. 256 values for the left channel and 256 values for the right channel. These values can be use to create Sound Spectrum Analyzer displays in Audio Players like Winamp and Windows Media Playres.)

► BitmapData.getPixels() (Generates a byte array from a rectangular region of pixel data. Writes an unsigned integer (a 32-bit unmultiplied pixel value) for each pixel into the byte array. No need to loop through every pixel in a bitmap, one at a time with getPixel to send a bitmap to the server.)

► MovieClip.currentLabel (This returns the label of the current frame as a String. The current label in which the playhead is located in the timeline of the MovieClip instance. If the current frame has no label, currentLabel is set to the name of the previous frame that includes a label. If the current frame and previous frames do not include a label, currentLabel returns null.)

► stage.frameRate ( At runtime frame rate of stage can be change)

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

20. Why are the columns in my DataGrid in some strange order?
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.

21. When I have only a single record, why does not it appear in my DataGrid?
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)

22. What is the difference in MovieClip and Sprite?
Sprite does not have timeline in it But Movie Clips can have. Sprite is the parent class of MovieClip though not all of the MovieClip properties are available in the parent class.

23. I have i input text field on stage and I have a button also, Further i am writing some text in that input text field. I want to save my written data on my local system (on my computer), How can i do this?
To achieve this you have to use flash CS4 with Flash Player 10 or above. Using the new method of filereference class you can save you typed text on your computer as a text file.

First create a object of filereference… then use the save method and pass your data to it.
var fR:FileReference =new FileReference()
fR.save("your Written text should be come here.","flexflashforum.txt")

Paste the following code on frame and run a sample application...

Code:
var TxtF:TextField = new TextField();
var BtnMc:TextField = new TextField();
var MyFile:FileReference = new FileReference();

TxtF.border = true;
TxtF.type = TextFieldType.INPUT;

BtnMc.background = true;
BtnMc.backgroundColor = 0xCCCCCC;
BtnMc.x = 150;
BtnMc.height = 20;
BtnMc.text = " Click here to save";

24. How can you show a jpg image in Dynamic Text Field?
Using HTML Tags in HTML enabled text field you can load image in that. Make a Dynamic Text Field on Stage and give it instance name "txt", On frame paste the following code and test your flash.

Code:
txt.htmlText ="<img src='http://www.globalguideline.com/images/ggl.gif' width='139' height='139'> This image is under Dynamic text field of flash "

25. How do I make synchronous data calls in actionscript?
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:
1. Create a function to handle the data return, like onResult().
2. In the HTTPService tag, put this function name in the result property and pass "event" in too.
3. Invoke the call in the script:
//invokes the call to the HTTP data service
var 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()
4. 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 call
var sQueryId = callResponse.MyQueryId; //will be "WhateverIWanttoUseToIdentifyThisCall";
trace(sQueryId);

26. How do I get Flex to query my database?
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.

27. How do I run Flex as a service?
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.

28. How do I pass parameters to a pop-up window in actionscript?
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.

29. Why are there errors with the macromedia.css.LocatorParser class and WebLogic?
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.

30. 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.getInstance() to get a reference to it.

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

32. What design patterns have you used? in Actionscript and java?
1. Creational Pattern
* Factory Method Pattern
* Singleton Pattern

2. Structural Patterns
* Decorator Pattern
* Adapter Pattern
* Coposite Pattern

3. Behavioral Patterns
* Command Pattern
* Observer Pattern
* Template Metod Pattern
* State Pattern
* Strategy Pattern

4. Multiple Patterns
* MVC Pattern
* Symetric Proxy Pattern

33. Explain how binding works in mxml components in flex?
  Binding in MXML
Lets look at the following code…
<mx:TextInput id=”ti1?/>
<mx:Label id=”label1? text=”{ti1.text}”/>
Here you are binding the text property of the TextInput to the label. So whatever you type in the textInput automatically reflects in the label. That’s the power of Binding…

The best practice for defining components that return information back to the main application is to design the component to dispatch  an event that contains the return data. In that way, the main  application can define an event listener to handle the event and take the appropriate action. You also use events in data binding.
The following example uses the Bindable metadata tag to make useShortNames a bindable property. The implicit setter for the useShortNames property dispatches the change event that is used internally by the Flex framework to make data binding work.


34. What is the difference between ChangeWatcher.watch, and BindingUtils.bindProperty?
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.

1. A String containing the name of a public bindable property of the host object.
ChangeWatcher.watch(this, "myvar", handler)

2. 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);

3. 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.bindProperty
Works 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.

35. Why would you want to keep a reference to a ChangeWatcher and call unwatch()?
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

36. How do you add event listeners in mxml components. Now AS3 components?
* addEventListener(type:String, listener:Function,
useCapture:Boolean = false, priority:int = 0,
useWeakReference:Boolean = false):void
* removeEventListener(type:String, listener:Function,
useCapture:Boolean = false):void
* dispatchEvent(event:Event):Boolean
* hasEventListener(type:String):Boolean
* willTrigger(type:String):Boolean

37. What does calling preventDefault() on an event do? How is this enforced?
Cancels an event's default behavior if that behavior can be canceled.. For example, the doubleClick event has an associated default behavior that highlights the word under the mouse pointer at the time of the event. Your event listener can cancel this behavior by calling the preventDefault() method.
You can use the Event.cancelable property to check whether you can prevent the default behavior associated with a particular event. If the value of Event.cancelable is true, then preventDefault() can be used to cancel the event; otherwise, preventDefault() has no effect.
What is the problem with calling setStyle()
Adobe Flex Actionscript Interview Questions with Answers

No comments:

Post a Comment