Thursday, April 23, 2009

I am on Adobe Feed Now :)


Today i am very delighted , my blog has been added in Adobe feeds , i would try my best to share my knowledge and views on RIA.

Its me on my Bullet.

Cheers

Varun Rathore

Adding Custom Components to Text Layout Framework(ADOBE LABS)


The Text Layout Framework is a set of ActionScript 3.0 libraries with support for complex scripts and advanced typographic and layout features not available in the TextField class,It allows us to add custom components and Display objects in the TextArea making the issue of adding headers, tables and providing loacl anchor links , also we can add multiple TextFlow elements in between the display objects and set the selection in between those elements. Still there are some Bugs which make the Text Layout framework informal to handle but overall we can achieve a good sort of text Typography which was earlier missing in Flash.
here is a code sniplet which i used to make multiple TextFlow elements inside onemain container.

// Creating a TextFlow for handling selected Text and editing
[Bindable]public var selectedFlow : TextFlow ;

// Adding UIComponent and TextFlow Dynamically, where is a public class //LinkedContainers extends Sprite
var dspObj : DisplayObject = new LinkedContainers();
dspObj.name = "dspObject";
var ufComponent = new UIComponent();

var custTextFlow : TextFlow = new TextFlow();
custTextFlow.flowComposer.addController(new DisplayObjectContainerController(ufComponent,textArea.width,textArea.height));

// setup event listeners for selection changed and ILG loaded
custTextFlow.addEventListener(SelectionEvent.SELECTION_CHANGE,selectionChangeListener,false,0,true);
custTextFlow.addEventListener(StatusChangeEvent.INLINE_GRAPHIC_STATUS_CHANGED,graphicStatusChangeEvent,false,0,true);
//_textFlow.addEventListener(CompositionCompletionEvent.COMPOSITION_COMPLETE,checkCompositionChange);
custTextFlow.addEventListener(SelectionEvent.SELECTION_CHANGE,function checkChange():void{
selectedFlow = custTextFlow;

Cheers
Varun Rathore

Wednesday, April 22, 2009

Reducing Flex Application Size Drastically


Most of us while working on Flex applications get into a big problem of downloading time , as the application size increases it takes more time to get downloaded on the client machine, here are few things which i found to reduce the size of the application which makes the download time to get reduced drastically

The following three methods acn reduce the swf size by 70%

1. go to project properties->flex build path->library path -> framework linkage->select RSL from drop down press ok
2. go to project properties->flex complier->additional complier arguments
add "-debug=false" in the end -> press apply and ok.

3. Using a modular approach for application building, this can further reduce the application size.

Cheers

Varun Rathore

Tuesday, April 21, 2009

REQUEST HEADERS in FLEX using GET - POST Methods


We can modify Request Header in Flex under the certain circumstances only

var header:URLRequestHeader = new URLRequestHeader("newHeader", "newValue");
var request:URLRequest = new URLRequest("http://www.[vrathore.blogspot].com/");
request.data = new URLVariables("name=Varun+Rathore");
request.requestHeaders.push(header);

However, its possible to modify the headers on a POST request only.
request.method = URLRequestMethod.POST;

This should be taken care that we specifically give the request method as the Flash Player will convert POST requests into GET requests if the request is empty.

Other thing which should be kept in mind is to pass atleast one variable along with the request. Otherwise the headers will remain unchanged.
var variables:URLVariables = new URLVariables();
variables.name = "newValue";
request.data = variables;

Cheers
Varun Rathore

About Me