Posts Tagged ‘UIComponent’

Using styles in Flex 4

January 27th, 2011 by aabhaanjan

We can modify the appearance of components through style properties.

Important points :

  1. The style properties that we can set on a component depend on the component’s architecture.
  2. The components in the MX component set (mx.controls.* and mx.containers.* packages) take one set of styles. Components in the Spark component set (spark.components.* package) allow an entirely different set of styles.
  3. Flex does not support controlling all aspects of component layout with CSS.
  4. Properties such    as xywidth, and height are properties, not styles, of the UIComponent class, and therefore cannot be set in CSS.
  1. For MX components to use CSS it should  implement the IStyleClient interface.

Example :

[xml]

<?xml version=”1.0″?>

<!– modules/StyleModLoaderApp.mxml –>

<s:Application

xmlns:fx=”http://ns.adobe.com/mxml/2009″

xmlns:s=”library://ns.adobe.com/flex/spark”

xmlns:mx=”library://ns.adobe.com/flex/mx”>

<s:layout>

<s:VerticalLayout/>

</s:layout>

<fx:Style>

@namespace s “library://ns.adobe.com/flex/spark”;

s|Button {

color:blue;

cornerRadius:10;

}

</fx:Style>

<s:Button id=”myButton” label=”Sample Styling”/>

</s:Application>

[/xml]

Tags: , , , ,

Flash Builder 4- Controls-Part 2

January 7th, 2011 by aabhaanjan

flex_cert3

OLAPDataGrid

Component Type : spark.components

Important points :

1. Its support for the display of the results of OLAP queries.

2. differences with AdvancedDataGrid control:

  • Column dragging is not allowed in the OLAPDataGrid control.
  • You cannot edit cells in the OLAPDataGrid control because cell data is a result of a query and does not correspond to a single data value in the OLAP cube.
  • You cannot sort columns by clicking on header in the OLAPDataGrid control. Sorting is supported at the dimension level so that you can change the order of members of that dimension.

PopUpButton

Component Type : mx.control

important points :

1. It contains a main button and a secondary button, called the pop-up button, which pops up any UIComponent object when a user clicks the pop-up button.

2 It can have a text label, an icon, or both on its face.

3. One common use for the PopUpButton control is to have the pop-up button open a List control or a Menu control that changes the function and label of the main button.

Default Characteristics:

Characteristic Description
Default size Sufficient width
Minimum size 0 pixels
Maximum size Undefined

Example :

PopUpMenuButton

Component Type : mx.control

important points :

1.The PopUpMenuButton control creates a PopUpButton control with a main sub-button and a secondary sub-button.

  1. Clicking on the secondary (right) sub-button drops down a menu that can be popluated through a dataProvider property.
  2. Difference with Menu and MenuBar controls : the PopUpMenuButton control supports only a single-level menu.
  3. It cannot contain cascading submenus.

Default characteristics:

Characteristic Description
Default size Sufficient
Minimum size 0 pixels.
Maximum size 10000 by 10000.

Example :

[xml]

<?xml version=”1.0″ encoding=”utf-8″?>

<s:Application xmlns:fx=”http://ns.adobe.com/mxml/2009″
xmlns:s=”library://ns.adobe.com/flex/spark”
xmlns:mx=”library://ns.adobe.com/flex/mx”>
<fx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.events.MenuEvent;

public function itemClickHandler(evt:MenuEvent):void {
}
]]>
</fx:Script>
<fx:Declarations>

<fx:XMLList>
<node label=”Inbox”/>
</fx:XMLList>
</fx:Declarations>
<s:Panel title=”PopUpMenuButton ”
width=”75%” height=”75%”
horizontalCenter=”0″ verticalCenter=”0″>
<s:VGroup left=”10″ right=”10″ top=”10″ bottom=”10″>
<s:Label width=”100%” color=”blue”
text=”Click the down arrow to open the menu.”/>
<mx:PopUpMenuButton
dataProvider=”{treeDP2}”
labelField=”@label”
itemClick=”itemClickHandler(event);”/>
</s:VGroup>
</s:Panel>
</s:Application>

[/xml]

ProgressBar

Component Type : mx.control

important points :

1. There are two types of ProgressBar controls: determinate and indeterminate.

  1. A determinate ProgressBar control is a linear representation of the progress of a task over time.
  2. Used determinate ProgressBar when the scope of the task is known. It displays when the user has to wait for an extended amount of time.

4. An indeterminate ProgressBar control represents time-based processes for which the scope is not yet known.

Default characteristics:

Characteristic Description
default size 150 pixels X 4 pixels
Minimum size 0 pixels
Maximum size Undefined

Example :

[xml]

<?xml version=”1.0″ encoding=”utf-8″?>

<s:Application xmlns:fx=”http://ns.adobe.com/mxml/2009″
xmlns:s=”library://ns.adobe.com/flex/spark”
xmlns:mx=”library://ns.adobe.com/flex/mx”>
<fx:Script>
<![CDATA[
private var j:uint = 0;

private function runit():void
{
if (j < 100) {
j += 10;
} else if (j >= 100) {
j = 0;
}
bar.setProgress(j, 100);
bar.label = “Current Progress: ” + j + “%”;
}
]]>
</fx:Script>
<s:Panel title=”Halo ProgressBar Control Example”
width=”75%” height=”75%”
horizontalCenter=”0″ verticalCenter=”0″>
<s:VGroup left=”10″ right=”10″ top=”10″ bottom=”10″>
<s:Label width=”100%” color=”blue”
text=”Click the button to increment the progress bar.” />
<s:Button label=”Run” click=”runit();”/>
<mx:ProgressBar labelPlacement=”bottom” chromeColor=”red”
minimum=”0″ visible=”true” maximum=”100″ label=”CurrentProgress 0%”
direction=”right” mode=”manual” width=”100%”/>
</s:VGroup>
</s:Panel>
</s:Application>

[/xml]

RadioButton

Component Type : spark.components

important points :

1. Difference with RadioButtonGroup

A RadioButtonGroup is composed of two or more RadioButton components with the same groupName property.

2

The RadioButton group can refer to the a group created by the <s:RadioButtonGroup> tag.

3. The user selects only one member of the group at a time. Selecting an unselected group member deselects the currently selected RadioButton component within that group.

Default characteristics:

Characteristic Description
Default size Wide enough
Minimum size 18 pixels X 18 pixels
Maximum size 10000 pixels X 10000 pixels
Default skin class spark.skins.spark.RadioButtonSkin

Example :

[xml]

<?xml version=”1.0″ encoding=”utf-8″?>

<s:Application xmlns:fx=”http://ns.adobe.com/mxml/2009″
xmlns:s=”library://ns.adobe.com/flex/spark”
xmlns:mx=”library://ns.adobe.com/flex/mx”>
<fx:Script>
import mx.controls.Alert;
</fx:Script>
<s:Panel title=”Halo RadioButton Control Example”
width=”75%” height=”75%”
horizontalCenter=”0″ verticalCenter=”0″>
<s:VGroup left=”10″ right=”10″ top=”10″ bottom=”10″>
<s:Label width=”100%” color=”blue”
text=”What year were women first allowed to compete in the Boston Marathon?”/>
<mx:RadioButton groupName=”year” label=”1942″/>
<mx:RadioButton groupName=”year” label=”1952″/>

<s:Button label=”Check Answer”
click=”Alert.show(option4.selected ? ‘Correct Answer!’:’Wrong Answer’, ‘Result’);”/>
</s:VGroup>
</s:Panel>
</s:Application>

[/xml]

RadioButton

Component Type : spark.components

Default characteristics:

Characteristic Description
Default size Wide enough
Minimum size 18 pixels X18 pixels
Maximum size 10000 X 10000 pixels
Default skin class spark.skins.spark.RadioButtonSkin

Example :

[xml]

<?xml version=”1.0″ encoding=”utf-8″?>

<s:Application xmlns:fx=”http://ns.adobe.com/mxml/2009″
xmlns:s=”library://ns.adobe.com/flex/spark”
xmlns:mx=”library://ns.adobe.com/flex/mx”>
<fx:Script>
<![CDATA[
import mx.controls.Alert;
import  mx.events.ItemClickEvent;

private function handleItem(evt:ItemClickEvent):void {
switch (evt.currentTarget.selectedValue) {
case “one”:
Alert.show(“You selected one”);
break;
case “two”:
Alert.show(“You selected Two”);
break;

}
}
]]>
</fx:Script>
<fx:Declarations>
<mx:RadioButtonGroup itemClick=”handleItem(event);”/>
</fx:Declarations>
<s:Panel title=”Halo RadioButtonGroup ”
width=”75%” height=”75%”
horizontalCenter=”0″ verticalCenter=”0″>
<s:VGroup left=”10″ right=”10″ top=”10″ bottom=”10″>
<s:Label width=”100%” color=”blue”
text=”Select a type of credit card.”/>
<mx:RadioButton groupName=”type” value=”one”
label=”oneExpress” width=”150″ />
<mx:RadioButton groupName=”type” value=”two”
label=”two” width=”150″ />

</s:VGroup>
</s:Panel>
</s:Application>

[/xml]

RichEditableText

Component Type : spark.components

important points :

1. The rich text can contain clickable hyperlinks and inline graphics .

  1. RichEditableText does not have scrollbars,
  2. It implements the IViewport interface for programmatic scrolling .
    1. RichEditableText uses the Text Layout Framework (TLF) library.
    2. The Spark architecture provides three text “primitives” — Label, RichText, and RichEditableText.
    1. Label is the fastest and most lightweight because it uses only FTE, not TLF.

Example :

[xml]

<?xml version=”1.0″ encoding=”utf-8″?>

<s:Application
xmlns:fx=”http://ns.adobe.com/mxml/2009″
xmlns:s=”library://ns.adobe.com/flex/spark”
xmlns:mx=”library://ns.adobe.com/flex/mx”>
<fx:Script>
<![CDATA[
import flashx.textLayout.conversion.TextConverter;
]]>
</fx:Script>
<fx:Declarations>
<fx:XML source=”externalTextFlow.xml” />
</fx:Declarations>
<s:Panel title=”RichText textFlow test”
width=”90%” height=”90%”
horizontalCenter=”0″ verticalCenter=”0″>
<s:Scroller width=”100%” height=”100%”>
<s:VGroup paddingLeft=”20″ paddingRight=”20″ paddingTop=”20″ paddingBottom=”20″>
<s:RichEditableText textAlign=”justify” percentWidth=”100″>
<s:textFlow>
<s:TextFlow>
<s:p fontSize=”24″>Inline TextFlow</s:p>
<s:p>1) text-text </s:p>

</s:TextFlow>
</s:textFlow>
</s:RichEditableText>
<s:RichEditableText textAlign=”justify” width=”100%”
textFlow=”{TextConverter.importToFlow(extTxtFlow, TextConverter.TEXT_LAYOUT_FORMAT)}” />
</s:VGroup>
</s:Scroller>
</s:Panel>
</s:Application>

[/xml]

RichText

Component Type : spark.components

important points :

1. RichText is a low-level UIComponent that can display one or more lines of richly-formatted text and embedded images.

2 It does not support scrolling, selection, editing, clickable hyperlinks, or images loaded from URLs.

  1. RichText uses the Text Layout Framework (TLF) library
  2. Difference with Text :
  • RichText offers better typography, better support for international languages, and better text layout than Text.
  • RichText has an object-oriented model of what it displays, while Text does not.
  • Text is selectable, while RichText does not support selection.

Default MXML property: content

Example :

[xml]

<?xml version=”1.0″ encoding=”utf-8″?>

<s:Application xmlns:fx=”http://ns.adobe.com/mxml/2009″ xmlns:s=”library://ns.adobe.com/flex/spark”>
<s:Panel title=”Spark RichText ”
width=”75%” height=”75%”
horizontalCenter=”0″ verticalCenter=”0″>
<s:Group left=”10″ right=”10″ top=”10″ bottom=”10″>
<s:RichText x=”0″ y=”0″ width=”75″ fontFamily=”Times” fontSize=”15″ textRotation=”rotate90″>
<s:content>Hello World!</s:content>
</s:RichText>
<s:Group x=”100″ y=”0″>
<s:RichText width=”100″ textAlign=”justify” paddingTop=”5″ paddingLeft=”5″ paddingRight=”5″ paddingBottom=”5″>
<s:content>Text-text-text</s:content>
</s:RichText>
<s:Rect width=”100%” height=”100%”>
<s:stroke>
<s:SolidColorStroke color=”red”/>
</s:stroke>
</s:Rect>
</s:Group>
<s:Group x=”225″ y=”0″>
<s:RichText width=”140″ height=”120″ columnCount=”2″ columnGap=”10″>
<s:content><s:span fontWeight=”bold”>Hello World!</s:span> Text-text-text</s:content>
</s:RichText>
<s:Rect width=”100%” height=”100%”>
<s:stroke>
<s:SolidColorStroke color=”red”/>
</s:stroke>
</s:Rect>
</s:Group>
</s:Group>
</s:Panel>
</s:Application>

[/xml]

Spinner

Component Type : spark.components

important points :

  1. A Spinner component selects a value from an ordered set.
  2. It uses two buttons that increase or decrease the current value .

Default characteristics:

Characteristic Description
Default size 19 pixels X 23 pixels
Minimum size 12 pixels X 12 pixels
Maximum size 10000 pixels X 10000 pixels
Default skin class spark.skins.spark.SpinnerSkin

Example :

[xml]

<?xml version=’1.0′ encoding=’UTF-8′?>

<s:Application xmlns:fx=”http://ns.adobe.com/mxml/2009″ xmlns:s=”library://ns.adobe.com/flex/spark” xmlns:mx=”library://ns.adobe.com/flex/mx”>

<mx:Panel title=”Spinner Control ” height=”75%” width=”75%” paddingTop=”10″
paddingLeft=”10″ horizontalCenter=”0″ verticalCenter=”0″>
<s:Group>
<s:layout>
<s:HorizontalLayout/>
</s:layout>
<mx:Text text=”Use the arrows to change tabs”/>
<s:Spinner maximum=”3″/>
</s:Group>

<mx:TabNavigator width=”75%” height=”75%” selectedIndex=”@{mySpinner.value}” >
<mx:HBox label=”Tab 1″>
<mx:Text text=”Text on Tab 1″ fontSize=”14″ color=”red”/>
</mx:HBox>
<mx:HBox label=”Tab 2″>
<mx:Text text=”Text on Tab 2″ fontSize=”16″ color=”blue”/>
</mx:HBox>

</mx:TabNavigator>

<mx:Label color=”purple” text=”Current Tab = {mySpinner.value+1}”/>
</mx:Panel>
</s:Application>

[/xml]

SWFLoader

Component Type : mx.controls

important points :

  1. The SWFLoader control loads and displays a specified SWF file.
  2. It is used for loading one Flex application into a host Flex application.

3. we can use the SWFLoader control to load a GIF, JPEG, or PNG image file at runtime, to load a ByteArray representing a SWF, GIF, JPEG, or PNG image at runtime, or load an embedded version of any of these file types, and SVG files, at compile time by using @Embed(source=’filename’).

4. The SWFLoader control lets you scale its content and set its size.

5. A SWFLoader control cannot receive focus. However, the contents of a SWFLoader control can accept focus and have its own focus interactions.

Default characteristics:

Characteristic Description
Default size enough for the loaded content
Minimum size 0 pixels
Maximum size Undefined

Example :

[xml]

<?xml version=”1.0″?>

<s:Application xmlns:fx=”http://ns.adobe.com/mxml/2009″
xmlns:s=”library://ns.adobe.com/flex/spark”
xmlns:mx=”library://ns.adobe.com/flex/mx”>
<s:VGroup>
<mx:SWFLoader source=”FlexApp.swf”/>
</s:VGroup>
</s:Application>

[/xml]

TextArea

Component Type : spark.components

important points :

1. The Spark version of TextArea uses the Text Layout Framework (TLF) library,

  • Spark TextArea offers better typography, better support for international languages, and better text layout.
  • Spark TextArea has an object-oriented model of rich text, while the MX version does not.
  • Spark TextArea has better support for displaying large amounts of text.
  • Spark TextArea requires that fonts be embedded differently than the MX version. To learn how to use the embedAsCFF attribute when you embed a font, see the font documentation.

The Spark TextArea control uses the TLF object-oriented model of rich text.

Default characteristics:

Characteristic Description
Default size 188 pixels X149 pixels
Minimum size 36 pixels X 36 pixels
Maximum size 10000 pixels X 10000 pixels
Default skin class spark.skins.spark.TextAreaSkin

Example :

[xml]

<?xml version=”1.0″ encoding=”utf-8″?>

<s:Application xmlns:fx=”http://ns.adobe.com/mxml/2009″
xmlns:s=”library://ns.adobe.com/flex/spark”>
<s:layout>
<s:BasicLayout />
</s:layout>
<s:Panel title=”Spark TextArea Control ”
horizontalCenter=”0″
verticalCenter=”0″>
<s:VGroup left=”10″ right=”10″ top=”10″ bottom=”10″>
<s:TextArea width=”400″ height=”100″>
<s:text>Text-Text-Text.</s:text>
</s:TextArea>

</s:VGroup>
</s:Panel>
</s:Application>

[/xml]

TextInput

Component Type : spark.components

important points :

1. This Spark version of TextInput makes use of the Text Layout Framework (TLF) library.

2.The widthInChars property provides a convenient way to specify the width in a way that scales with the font size.

  1. This control dispatches a FlexEvent.ENTER event when the user pressed the Enter key .
  2. rather than inserting a line break, because this control does not support entering multiple lines of text.
  3. By default, this control has explicit line breaks.

6. As a result of RichEditableText using TLF, the Spark TextInput control supports displaying left-to-right (LTR) text.

Default characteristics:

Characteristic Description
Default size 128 pixels X 22 pixels
Maximum size 10000 pixels X 10000 pixels
Default skin class spark.skins.spark.TextInputSkin

Example :

[xml]

<?xml version=”1.0″?>

<s:Application xmlns:fx=”http://ns.adobe.com/mxml/2009″ xmlns:s=”library://ns.adobe.com/flex/spark”>
<s:layout>
<s:BasicLayout />
</s:layout>
<s:Panel title=”Spark TextInput Control ”
horizontalCenter=”0″ verticalCenter=”0″>
<s:VGroup left=”10″ right=”10″ top=”10″ bottom=”10″>
<s:TextInput text=”Hello World!” />
<s:Button label=”Copy Text” click=”dest.text = src.text” />
<s:TextInput />
</s:VGroup>
</s:Panel>
</s:Application>

[/xml]

ToggleButton

Component Type : spark.components

Default characteristics:

Characteristic Description
Default size Wide enough
Minimum size 21 pixels X 21 pixels
Maximum size 10000 pixels X 10000 pixels
Default skin class spark.skins.spark.ToggleButtonSkin

Example :

[xml]

<?xml version=”1.0″?>

<s:Application xmlns:fx=”http://ns.adobe.com/mxml/2009″ xmlns:s=”library://ns.adobe.com/flex/spark” xmlns:mx=”library://ns.adobe.com/flex/mx”>
<fx:Script>
<![CDATA[

private function printMessage(evt:Event):void  {
if (evt.target.selected){
message.text += “fontWeight: bold” + “\n”;
lbl.setStyle(“fontWeight”, “bold”);
togBtn.label = “Bold”;
} else{
message.text += “fontWeight: normal” + “\n”;
lbl.setStyle(“fontWeight”, “normal”);
togBtn.label = “Normal”;
}
}
]]>
</fx:Script>
<s:Panel title=”Spark ToggleButton Control ”
width=”75%” height=”75%”
horizontalCenter=”0″ verticalCenter=”0″>
<s:VGroup left=”10″ right=”10″ top=”10″ bottom=”10″>
<s:ToggleButton label=”Normal” click=”printMessage(event);” />
<s:Label text=”Label” />
<s:TextArea height=”100%” width=”100%” color=”#0000FF” />
</s:VGroup>
</s:Panel>
</s:Application>

[/xml]

Tree

Component Type : mx.controls

important points :

1 The Tree class uses an ITreeDataDescriptor or ITreeDataDescriptor2 object to parse and manipulate the data provider.

2. The default tree data descriptor, an object of the DefaultDataDescriptor class, supports XML and Object classes; an Object class data provider must have all children in children fields.

Default sizing characteristics:

Characteristic Description
Default size Wide enough to accommodate the icon, label, and expansion triangle, if any, of the widest node in the first 7 displayed (uncollapsed) rows, and seven rows high, where each row is 20 pixels in height. If a scroll bar is required, the width of the scroll bar is not included in the width calculations.
Minimum size 0 pixels.
Maximum size 5000 by 5000.

Example :

[xml]

<?xml version=”1.0″ encoding=”utf-8″?>

<s:Application xmlns:fx=”http://ns.adobe.com/mxml/2009″
xmlns:s=”library://ns.adobe.com/flex/spark”
xmlns:mx=”library://ns.adobe.com/flex/mx”>
<fx:Script>
<![CDATA[
[Bindable]
public var selectedNode:XML;

public function treeChanged(evt:Event):void {
selectedNode = Tree(evt.target).selectedItem as XML;
}
]]>
</fx:Script>
<fx:Declarations>
<fx:XMLList>
<node label=”Mail Box”>
<node label=”Inbox”>
<node label=”XYZ”/>

</node>

</node>
</fx:XMLList>
</fx:Declarations>
<s:Panel title=”Halo Tree Control Example”
width=”75%” height=”75%”
horizontalCenter=”0″ verticalCenter=”0″>
<s:VGroup left=”10″ right=”10″ top=”10″ bottom=”10″>
<s:Label width=”100%” color=”blue”
text=”Select a node in the Tree control.”/>
<mx:HDividedBox width=”100%” height=”100%”>
<mx:Tree width=”50%” height=”100%” labelField=”@label”
showRoot=”false” dataProvider=”{treeData}” change=”treeChanged(event);”/>
<s:TextArea height=”100%” width=”50%”
text=”Selected Item: {selectedNode.@label}”/>
</mx:HDividedBox>
</s:VGroup>
</s:Panel>
</s:Application>

[/xml]

VideoDisplay

Component Type : spark.components

important points :

1. The VideoDisplay class is chromeless video player that supports progressive download, multi-bitrate, and streaming video.

  1. It does not support skinning.

Default characteristics:

Characteristic Description
Default size 0 pixels wide by 0 pixels high with no content, and the width and height of the video with content
Minimum size 0
Maximum size 10000 pixels X 10000 pixels

VideoPlayer

Component Type : spark.components

important points :

  1. The VideoPlayer control is a skinnable video player that supports progressive download, multi-bitrate streaming, and streaming video.
  2. It supports playback of FLV and F4v files. The VideoPlayer control contains a full-featured UI for controlling video playback..

Default characteristics:

Characteristic Description
Default size 263 pixels X 184 pixels
Minimum size 0
Maximum size 10000 pixels X 10000 pixels high
Default skin class spark.skins.spark.VideoPlayerSkin

VScrollBar

Component Type : spark.components

important points :

1. we can use the VScrollBar control as a stand-alone control, we usually combine it as part of another group of components to provide scrolling functionality.

Default characteristics:

Characteristic Description
Default size 15 pixels X 85 pixels
Minimum size 15 pixels X 15 pixels
Maximum size 10000 pixels X 10000 pixels
Default skin classes spark.skins.spark.VScrollBarSkin

spark.skins.spark.VScrollBarThumbSkin

spark.skins.spark.VScrollBarTrackSkin

VSlider

Component Type : spark.components

important points :

1. The slider can allow a continuous range of values between its minimum and maximum values

Default characteristics:

Characteristic Description
Default size 11 pixels X 100 pixels
Minimum size 11 pixels X 11 pixels
Maximum size 10000 pixels X 10000 pixels high
Default skin classes spark.skins.spark.VSliderSkin

spark.skins.spark.VSliderThumbSkin

spark.skins.spark.VSliderTrackSkin

Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Flex Most Asked Question In Interviews

August 26th, 2010 by aabhaanjan

Q 1. Types of Binding

Quick Answer:

Three types of Data binding are there :

a) the curly braces ({}) syntax

b) <mx:Binding> tag in MXML

c) BindingUtils methods in ActionScript.

Detail Answer :

Data binding:
Data binding is the way of binding the data in one object to another object.

Adobe Flex 2 provides three ways to specify data binding: the curly braces ({}) syntax and the <mx:Binding> tag in MXML and the BindingUtils methods in ActionScript.

Data binding requirements:

Data binding requires a source property, a destination property, and a triggering event that indicates when to copy the data from the source to the destination. To use a property as the source of a data binding expression, the component must be implemented to support data binding, which means that the component dispatches an event when the value of the property changes to trigger the binding.

How it works?

At compile time, the MXML compiler generates code to create ActionScript Watcher and Binding objects that correspond to the binding tags and expressions found in an MXML document. At run time, Watcher objects are triggered by change events that come from the constituent parts of binding source expressions; the Watcher objects then trigger Binding objects to execute bindings.

When you specify a property as the source of a data binding, Flex monitors not only that property for changes, but also the chain of properties leading up to it. The entire chain of properties, including the destination property, is called a “bindable property chain“. In the following example, firstName.text is a bindable property chain that includes both a firstName object and its text property:

<first>{firstName.text}</first>

When Binding doesn’t works?

Its not necessary that the binding executes automatically. In the following case the binding wont execute automatically as expected.

  1. Binding does not execute automatically when you change an entire item of a dataProvider property.
  2. Binding also does not execute automatically for subproperties of properties that have [Bindable] metadata.
  3. Binding also does not execute automatically when you are binding data to a property that Flash Player updates automatically, such as the mouseX property.

Some Binding Methods

The executeBindings() :

 method of the UIComponent class executes all the bindings for which a UIComponent object is the destination. All containers and controls, as well as the Repeater component, extend the UIComponent class.

The executeChildBindings() :

method of the Container and Repeater classes executes all of the bindings for which the child UIComponent components of a Container or Repeater class are destinations. All containers extend the Container class.

The executeBindings():

 when you are sure that bindings do not execute automatically.

Q 2. How to create your own event

 

Quick Answer :

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

Detail Answer :

You Extend EventDispatcher like this:

import flash.events.*;
�
  public class MyDispatcher extends EventDispatcher {
    private function doIt(event:Event):void {
      dispatchEvent(new Event("myEvent")); �
  }
}

we can also create a separate class that extends Event

For example :

public class EventManagerClass extends EventDispatcher
{
    // ...

    public function myFunction():void
    {
        dispatchEvent(new MyEvent(someData));
    }
}

public class MyEvent extends Event
{
    private var _myEventData:Object;

    public function MyEvent(eventData:Object)
    {
        _myEventData = eventData;
    }
}

so then in your handler, you’d just:

private function myHandler(event:MyEvent):void
{
    trace(event.myEventData.toString());
}

Q 3. Event Bubbling
Quick Answer :

The mechanism through which event objects are passed from the objects that generates an event up through the containership hierarchy

Detail Answer :

Phases of Event:

There are three phases of an Event

Each phase represents a path or the location of an event as it works itself through the display objects in Flash that relate to that event.

  • Capturing phase: This represents the parent objects of the target object from which the event originated. Any propagated event starts with the topmost parent (stage) and works down the display object hierarchy until reaching the original target.
  • At target phase: The target phase is the phase where the event is at the target object or the object from which the event originated. Unlike the capturing and bubbling phases, this phase always relates to only one object, the target object.
  • Bubbling phase: When an event “bubbles” it follows the reverse path of the capturing phase and works its way back up the parent hierarchy of the target object until reaching the top-most parent or stage.

Any class involved in bubbling must extend DisplayObjectContainer.

How event bubbling works an Example ?

Here is three classes.

The primary class includes Level1.

Level1 includes Level2.

Level2 includes Level3.

Level3 triggers an event when it’s added to the stage. The event from Level3 will bubble through Level2 and Level1 to the primary class without re-dispatching it.

event_bubbling_as.as

package {
    import flash.display.Sprite;
    import flash.events.Event;
    import obj.Level1;
    import obj.Level3;
    public class event_bubbling_as extends Sprite
    {
        private var _level1:Level1
        public function event_bubbling_as()
        {
            _level1 = new Level1;
            _level1.addEventListener(Level3.EVENT, onEvent);
            addChild(_level1);
        }
        private function onEvent(event:Event) : void {
                trace('caught event from level 3');
        }
    }
}

 

Level1.as

package obj
{
    import flash.display.Sprite;
    public class Level1 extends Sprite
    {
        private var _level2:Level2;
        public function Level1()
        {
            trace("in level 1");
            _level2 = new Level2;
            addChild(_level2);
        }
    }
}

 

Level2.as

 

package obj
{
    import flash.display.Sprite;
    public class Level2 extends Sprite
    {
        private var _level3:Level3;
        public function Level2()
        {
            trace("in level 2");
            _level3 = new Level3;
            addChild(_level3);
        }
    }
}

 

Level3.as

package obj
{
    import flash.display.Sprite;
    import flash.events.Event;
    public class Level3 extends Sprite
    {
        public static const EVENT:String = "level3";
        public function Level3(){
            trace("in level 3");
            //trigger event when the object is added to the stage
            addEventListener(Event.ADDED_TO_STAGE, launchEvent);
        }
        public function launchEvent(event:Event) : void {
         var newEvent:Event = new Event(EVENT, true, true);
         dispatchEvent(newEvent);
        }
    }
}

Q 4. Life cycle of Flex Application/Component?
Quick Answer :

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

Q 5.How you implement MVC in your Application
Ans: 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.
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

 

Q 6. Difference btw Java and Flex Getters Setters
Ans: 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.

Q 7. How many events are fired when your focus goes in one text box, you enter some text and then press tab.
Quick Answer :

PreinitializeHandler(), initializeHandler(), itemEditBegin, itemEditEnd, creationComplete()

Q 8. How you use styles different ways of using Style sheet
Quick Answer :

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

Q 9. How can you use two Styles at the same time
Quick Answer :

Using external style sheets and use Inline style commands

Q 10. Try to remember properties of few imp components
Quick Answer :
< 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. –>
<>

<>{zip.text}
< /mx:request>
< /mx:operation>

Q 11. What is the difference between Flex 2.0 and Flex 3.0
Ans: 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, CS3 Suite integration, CSS Outline, CSS Design View, Flex 3 SDK Skinning/Style Enhancements

Q 12. How will you call Java method from Flex?
Quick Answer :

Using RemoteObject. Explain the process to interviewer

Q 13. What are the config files used for connecting Java and Flex?
Quick Answer :
data-management-config.xml,
messaging-config.xml,
proxy-config.xml,
remoting-config.xml,
services-config.xml

Q 14. What are the channels and their types
Quick Answer :

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 directly
In Flex AMFChannel is used mostly. Action Message Format
Methods
applySettings (),connect(),connectFailed(),connectSuccess(), connectTimeoutHandler()
disconnect(),disconnectFailed(),disconnectSuccess(),flexClientWaitHandler(), getMessageResponder(),internalConnect(),internalDisconnect(),internalSend(),logout()
send(),setCredentials()
Properties
authenticated,channelSets,connected,connectTimeout,endpoint,failoverURIs,protocol,
reconnecting,recordMessageSizes,recordMessageTimes,requestTimeout,uri

Q 15. Give the name of Collection which can be mapped to java and Flex and vice-versa
Ans: java.lang.String String
java.lang.Boolean, boolean Boolean
java.lang.Integer, int int
java.lang.Short, short int
java.lang.Byte, byte[] int
java.lang.Byte[] flash.utils.ByteArray
java.lang.Double, double Number
java.lang.Long, long Number
java.lang.Float, float Number
java.lang.Character, char String
java.lang.Character[], char[] String
java. math.BigInteger String
java.math.BigDecimal String
java.util.Calendar Date
java.util.Date Date
java.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 object
java.lang.Object (other than previously listed types) Typed Object
Objects 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.

Q 16. How can you call JavaScript from MXML
Quick Answer :

IExternalInterface.call()

Q 17. How can you access a var defined in 1 MXML flex in to another MXML file
Quick Answer :

Create 1 object of MXML fiel into another MXML File

Q 18. Is it possible to make httpService Requests synchronous?
Quick Answer :

var mytoken:AsyncToken = yourservice.send();
mytoken.addResponder(new ItemResponder(function,errorFunction));
OR
You can create a result handler to your HTTPService.
remoteObjectName.Your method
name.addEventListener(“result”,HandlerFunction,false,0,true);

Q 19. I need to load an image from flickr into my application. Do I need a crossdomain.xml file on flickr?
Quick Answer :

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

Q 20. What is the difference between httpService and Data Service?
Basically, Flex allows three types of RPC services: HttpService, WebServices, and RemoteObject Services. In Flex, using the “RemoteObjects specifies named or unnamed sources and connects to an Action Message Format (AMF) gateway, whereas using the HTTPService and WebService use named services or raw URLs and connect to an HTTP proxy using text-based query parameters or XML”. Specifically, HTTPServices use raw HTTP requests, WebServices use the SOAP protocol and RemoteObjects uses AMF3.

Q 21. How do you generate random numbers within a given limit with actionscript?
Quick Answer :

var randNum:Number = Math.random()*100;

Q 22. Have you built any components with actionscript? If so explain how you did it?
Quick Answer :
package myComponents{
import mx.controls.Button;
public class MyButton extends Button {
public function MyButton() {
super();
label=”Submit”;
}}}

Q 23. 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.

Q 24. I am going to add images into a tag. How will it resize itself?
Quick Answer :
Q 25. What is a resource Manager??
Quick Answer :
Q 26. What are the similarities between java and flex?
Quick Answer :
Q 27. What is the dynamic keyword used for?
Quick Answer :
Q 28. How do you implement push with flex data services?
Quick Answer :
Q 29. What are the methods called when a UI component is intialized?
Quick Answer :
Q 30. How do you implement drag and drop on components that do not support ondrag and ondrop?
Quick Answer :
Q 31. Can you write to the file system from flex?
Quick Answer :
Q 32. What is a drag manager?
Quick Answer :

Manages the drag-and-drop operations; for example, its doDrag() method starts the drag operation.

Q 33. How do you call javascript from Flex?
Quick Answer :

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

Q 34. How do you use a repeater?
Quick Answer :
< dataprovider=”{dp}”>
< height=”49″ width=”50″ click=”Alert.show(String (event.currentTarget.getRepeaterItem()) + ‘ pressed’)” label=”{String (rp.currentItem)}”>
< /mx:repeater>

Q 35. What are three ways to skin a component in flex?
Quick Answer :

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.

Q 36. How do you use css styles in flex?
Quick Answer :

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.

Q 37. What is the difference between sealed class and dynamic classes?
Quick Answer :

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 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
}

Q 38. What is e4X and XML?
Quick Answer :

E4X means “ECMAScript For XML
Using 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 =
<>
<>
<>burger
<>3.95
< /item>
<>
<>fries
<>1.45
< /item>
< /order>
trace (myXML.item[0].menuName); // Output: burger
trace (myXML.item.(@id==2).menuName); // Output: fries
trace (myXML.item.(menuName==”burger”).price); // Output: 3.95

Q 39. What is state? What is the difference between states and ViewStack?
Quick Answer :

View Stack is to handle different MXML file eg TAB control, and states is the transition within single MXML file

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

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

One of the coolest and most useful features I use in Flex are item renderers. They allow us to customize how lists and datagrids display information.

Quick Answer :

To get one of the drop-in renderers working all we need to do is simply set a property on the DataGridColumn named itemRenderer. In the third column we are going to set this property equal to mx.controls.CheckBox, which is the name of the component we want to use for the item renderer. Now we have a nice pretty checkbox instead of “true” or “false”. But if you remember I mentioned they were limited in functionality, well this is very true because beyond what we have done we can’t really do much else. This includes not being able to disable the checkbox, change the alignment, or anything else. The following code is our new DataGridColumn for the favorite property.

<mx:DataGridColumn headerText=”Favorite” dataField=”isFavorite” width=”75″
itemRenderer=”mx.controls.CheckBox”/>

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

Quick Answer :

Private variables cannot be referred outside the class. “this” keyword can be used to refer private variable within a class.

Q 42. How polymorphism works on actionscript?

Quick Answer :

Polymorphism describes multiple possible states for a single property. Another way of expressing this in OOPs is, different classes implementing the same method names. Polymorphism is achieved in actionscript with keyword Override.
Q 43.. How do you overload functions in actionscript?

Quick Answer :

Overloading is not supported in actionscripts current version(as3). Workaround for this is to declared method with wildcard data-type and handling it logically inside as show below.

function functionName(parm:*):void

{

If(parm is String)

{

//do string operation..

} else if(parm is Number)

{

//do number operation..

} else if ….

{

//do required specific operations…

}else

{

throw new customError(“datatype not supported”)

}

}

Q 44. What is dynamic keyword used for?
Quick Answer :

Those Classes which should be extended and changed are called Dynamic classes

Ans:In actionscript by making a class dynamic, it is possible to add properties and methods programmatically at runtime. A class can be declared dynamic by adding keyword “dynamic” to the class definition.

dynamic class ClassName {

//class definition…

}

Q 45. What are sealed classes?
Quick Answer :

Classes which you cant extend… ex String

Ans:Actionscript classes that are not declared as dynamic are called sealed classes. So normally all classes are sealed by default.
Technically speaking, an instance of a sealed can have only properties and method which are already declared in that  classes.

Q 46. What are runtime shared libraries?

Quick Answer :

In Flex Builder, to use dynamically-linked libraries, you specify either RSL or External as the Link Type in the Library Path dialog for the library.

RSL benefits

The following example shows the possible benefit of separating shared components into an RSL. In this example, the library’s size is 150 KB (kilobytes) and the compiled application’s size is 100 KB. Without RSLs, you merge the library into both applications for an aggregate download size of 500 KB. If you add a third or fourth application, the aggregate download size increases by 250 KB for each additional application.

With RSLs, the RSL needs to be downloaded once only. For two applications that use the same RSL, the result is an aggregate download size of 350 KB, or a 30% reduction. If you add a third or fourth application, the aggregate download size increases by 100 KB instead of 250KB for each additional application. In this example, the benefits of using an RSL increase with each new application.

In this example, the applications with statically-linked libraries run only after Adobe® Flash® Player loads the 250 KB for each application. With dynamically linked RSLs, however, only the first application must load the entire 250 KB (the combined size of the application and the RSL). The second application runs when just 100 KB loads because the RSL is cached.

The illustrated scenario shows one possible outcome. If your applications do not use all of the components in the RSL, the size difference (and, as a result, the savings in download time) might not be as great. Suppose that each application only uses half of the components in the RSL. If you statically link the library, only those classes that are used are included; the output, as a result, is 100 KB + 75 KB for the first application and the library and 100 KB + 75 KB for the second application and the library, or an aggregate download size of 350 KB. When you use a library as an RSL, its entire SWF file must be transferred across the network and loaded by the application at run time, regardless of how much of that library is actually used. In this second case, the combined download size when using RSLs and when not using RSLs is the same.

In general, the more Flex applications that use a common RSL, the greater the benefit.

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 ready 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 “sgn” 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. It may be a third party or your component to be shared across.

Q 47. What is caringhorm? How do you use it? Have you worked with Cairngorms?
Quick Answer :
Q 48. What keyword allows you to implement abstraction better?

Quick Answer :

There is no keyword in as3 to implement abstraction directly, but there are workaround available for this. One of the best followed way is runtime enforcement of abstract classes.

Q 49. What design patterns have you used? In Actionscript and java?
Quick Answer :
Q 50. What’s the difference between Java and AS3 getters and setters?

Quick Answer :

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.
Q 51. Explain the component lifecycle.

Quick Answer :
Q 52. Tell me about dataServices

Quick Answer :
Q 53. understanding of MVC

Quick Answer :
Q 54. 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:

Quick Answer :
Q 55. Explain how binding works in mxml components.

Quick Answer :

Q 56. Explain the ChangeWatcher.Wach()
Quick Answer :

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

Q 57. Why would you want to keep a reference to a ChangeWatcher and call unwatch()?

Quick Answer :
Q 58. How do you add event listeners in mxml components. Now AS3 components?

Quick Answer :
Q 59. What does calling preventDefault() on an event do? How is this enforced?
Quick Answer :

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

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

Quick Answer :

Q 61. 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?

Quick Answer :
Q 62. What are some ways to specify styles on components?

Quick Answer :

Q 63. What is the problem with calling setStyle()
Quick Answer :

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
Q 64. Explain the difference between creating an effect and setting the target as opposed to adding an effectListener

Quick Answer :
Q 65. What do repeater components do?

Quick Answer :
Q 66. How do you identify a component created in a repeater?

Quick Answer :

Q 67. What is state? What is the difference between states and ViewStack?

Quick Answer :

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.

Q 68. What is the difference between httpService and Data Service?

Quick Answer :

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 objects
A 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.

Q 69. Why you don’t Embed all images in your application
Quick Answer :

That increases the size of the SWF File

Q 70. What type of images can be loaded
Quick Answer :

(PNG, GIF, JPEG, SWF at run time and PNG, GIF, JPEG, SWF, SVG at compile time)

Q 71. Explain ContainerCreationPolicy
Quick Answer :

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.

Q 72. What are the factory classes
Quick Answer :

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.

Q 73. Explain Metadata
Quick Answer :

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.

Q 74. I was asked too many questions on the event bubbling, Like how to capture and event if the component is disabled.
Quick Answer :

addEventListner on the parents and enable the component in that handler

Q 75. obj.addEventListener(MouseEvent.CLICK, MouseClickHAndler); in this obj should inherit which class?
Quick Answer :

DispachEvent
You can manually dispatch events using a component instance’s dispatchEvent() method. All components that extend UIComponent have this method
objectInstance.dispatchEvent(event:Event):Boolean

Q 76.Why we extent Sprite Class in our Graphical Classes?
Quick Answer :
Q 77.What is Layout Manager and explain the Properties and Methods?
Quick Answer :

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 LayoutManager
usePhasedInstantiation : Boolean

A flag that indicates whether the LayoutManager allows screen updates between phases.

Q 78.How do you call a method in particular ItemRenderer. Also the ItemRenderer is your own Custom Component.
Quick Answer :
<>
< 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>

Q 79.How can you implement Singleton in Flex Application?
Quick Answer :

If you are a Java Programmer dont be mistaken by saying create Private Constructor. We cant create private Constructor in Flex.

Q 80.Give similiarities btw Java and Flex
Quick Answer :

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

26) What is the difference between httpService and Data Service? (*)

Flex allows three types of RPC services: HttpService, WebServices, and RemoteObject Services. In Flex, using the “RemoteObjects specifies named or unnamed sources and connects to an Action Message Format (AMF) gateway, whereas using the HTTPService and WebService use named services or raw URLs and connect to an HTTP proxy using text-based query parameters or XML”. Specifically, HTTPServices use raw HTTP requests, WebServices use the SOAP protocol and RemoteObjects uses AMF3. “RemoteObject provides two advantages over HTTP or SOAP. First, while the AMF protocol uses HTTP to transfer packets, the data is transferred in a binary format that is natively understood by the Flash Player. As a result, data can move across the network more quickly and it can be deserialized more rapidly than text-based formats such as XML. Both of these result in performance gains, particularly where large sets of data are involved. Secondly, RemoteObject provides signficant productivity advantages. The remoting service, which runs on your server, automatically marshalls data between AMF and your server-side language (e.g., PHP, Java, C#). As a result, you can directly call methods on your PHP objects without having to write an XML REST interface or create web service interfaces”.

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

Ans: When you define a simple component in ActionScript, you do not create a component, but you modify the behavior of an existing component. In the following example you create a subclass of the ComboBox class to create a custom ComboBox called CountryComboBox that is prepopulated with a list of countries. AS3 CODE:

package components

{

import mx.controls.ComboBox;

public class CountryComboBox extends ComboBox

{

public function CountryComboBox()

{

dataProvider = [ “India”, “Sri Lanka” ];

}

}

}

MXML Usage of the above class:

Tags: , , , , , , , , , , , , , , , ,