Adobe Flex Actionscript

  Home  Adobe  Adobe Flex Actionscript


“Adobe Flex and Actionscript Interview Questions Answers Tutorial and Guide to build your knowledge for better career. Adobe Flex is a highly productive application also called actionscript, its free and open source framework for building and maintaining expressive web applications that deploy consistently on all the web browsers, desktops, and operating systems. Adobe Flex actionscript Interview Questions and Answers will guide you about all the aspects of Adobe Flex Actionscript.”



84 Adobe Flex Actionscript Questions And Answers

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

 225 views

2⟩ What is state? what is the difference between states and ViewStack in flex?

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:

* View Stack 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.

* ViewStates are virtual state of an existing page apearing 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

 249 views

3⟩ 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");

 238 views

4⟩ 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 title="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>

 220 views

5⟩ 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"...>

 228 views

7⟩ 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).

 223 views

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

 243 views

9⟩ How do we call javascript from Flex actionscript?

Using the ExternalInterface API to access JavaScript from Flex and Using the navigateToURL() method in Flex. The navigateToURL() method is in the flash.net package

flash.external.ExternalInterface.call(function_name:String[, arg1, ...]):Object;

navigateToURL(request:URLRequest, window:String):void

 220 views

10⟩ 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).

 237 views

11⟩ What are the methods called when a UI component is intialized?

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

 240 views

12⟩ 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.

 217 views

13⟩ 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.

 237 views

15⟩ When I add or modify an item in my dataProvider, why does not it show up in my DataGrid?

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 dataProvider to the control, as follows: myDataGrid.dataProvider = myDataProvider;

 261 views

16⟩ myTree appears just fine but why ca not I access the node attributes?

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

But the following example is far more reliable:

myTree.selectedNode.getProperty("myAttribute");

 232 views

17⟩ 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.

 224 views

18⟩ 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.

 216 views

20⟩ 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.

 239 views