Showing posts with label Flex. Show all posts
Showing posts with label Flex. Show all posts

Friday, March 27, 2009

How do you implement push on a flex applications

Question :How do you implement push on a flex applications?
Answer :Using BlazeDS Server, LiveCycle Data Services,

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

Question :I am going to add images into a tag. How will it resize itself?
Answer :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.

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

Question :I am going to add images into a tag. How will it resize itself?
Answer :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.

What is a resource Manager

Question :What is a resource Manager??
Answer :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.

What are the similarities between java and flex

Question :What are the similarities between java and flex?
Answer :
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).

What is the dynamic keyword used for

Question :What is the dynamic keyword used for?
Answer :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.

How do you implement push with flex data services

Question :How do you implement push with flex data services?
Answer :Using Blaze DS Server & LCDS

What are the methods called when a UI component is intialized

Question :What are the methods called when a UI component is intialized?
Answer :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).

Can you write to the file system from flex

Question :Can you write to the file system from flex?
Answer :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");

What is a drag manager

Question :What is a drag manager?
Answer :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.

How do you call javascript from Flex

Question :How do you call javascript from Flex?
Answer :: 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

How do you use a repeater

Question :How do you use a repeater?
Answer :

[Bindable]
public var myArray:Array=[1,2,3,4];
]]>

paddingRight="10" paddingTop="10">




What are three ways to skin a component in flex

Question :What are three ways to skin a component in flex?
Answer :: 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).

How do you use css styles in flex

Question :How do you use css styles in flex?
Answer :External styles are defined in a separate file and can be used in any MXML file that references the
CSS file. You reference a CSS file into an MXML file with the source property of the
tag, as follows:

Embedded styles are defined in an MXML file and can only be used in that file. Embedded styles
are defined with the tag, as follows:

.myclass { background-color: xFF0000 }
TextInput { font-family: Helvetica; font-size: 12pt }




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

What is the difference between sealed class and dynamic classes

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

What is MVC and how do you relate it to flex apps

Question :What is MVC and how do you relate it to flex apps?
Answer :: (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.

What is state what is the difference between states and ViewStack

Question :What is state? what is the difference between states and ViewStack?
Answer :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.
Diff :
1) View Stack is to handle different MXML file eg TAB control and states is the transition within
single MXML file.
2) 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.
3) 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

How does item renderer work How do I add item renderer at runtime

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

What keyword allows you to refer to private variables of a class

Question :What keyword allows you to refer to private variables of a class?
Answer :private keyword , this keyworld

How polymorphism works on actionscript

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