Thursday, January 20, 2011



Set the draggable of TitleWindow to false

You may need to have a titlewindow in a popup, but centered and not draggable. In such a case, simple set the "isPopUp" property in the creationComplete method


<mx:TitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009" 
   xmlns:s="library://ns.adobe.com/flex/spark" showCloseButton="true" close="onCancelSelected();" 
   xmlns:mx="library://ns.adobe.com/flex/mx" width="1000" height="550" creationComplete="onCreationComplete()" layout="absolute">
private function onCreationComplete():void{

    this.isPopUp = false;

}



Set column itemrenderer dynamically

We can create datagrid columns dynamically. In such cases, is you need to set a custom item renderer for the column:


myColumn.itemRenderer = new ClassFactory(com.renderers.CustomCBRenderer);

Thursday, October 14, 2010

Flex Tips, Tricks and Fixes


Focus to TextInput

If you have a login screen, and want to set focus to inputText component, you will find that although it has focus, the cursor is not inside the component and you cannot start typing right away. This is only for Application files, and occurs because the swf does not have focus yet.
A fix to this is using ExternalInterface to set focus to the swf:


ExternalInterface.call('function browserFocus(){document.getElementById(\'main\').focus();

Note: Replace "main" with your application name.

Set the buttonMode of Flex TitleWindow Close button/ Access TitleWindow close button

To set the button mode of a TitleWindow close button, use the following code inside the creationComplete method of the TitleWindow file:

var btn:Button = this.mx_internal::closeButton;
btn.buttonMode = true

Note: If you want to write this code in another file, just replace "this" with the name of the TitleWindow instance.


Monday, November 2, 2009

EXIF Reader in Flex+AIR II


Now that files and folders can be selected, I move on to the next step, which contains the following substeps:

  • Validating the selected files/folders
  • Batch Loading the files
  • On every file load, get the EXIF info for that file and save it as XML
A.Validating the selected files/folders


For the purpose of validating and loading Files I have created a class called "EXIFReaderClass"


<mx:Button x="10" y="534" label="Run EXIFReader" width="482" click="startReading()"/>



private function startReading():void{
             objEXIFReader.init(fsTree.selectedPaths)
}

The selectedPaths contains all the selections from the FileSystemTree component.


The validation is done in the EXIFReader Class:












EXIF Reader in Flex+AIR

Hi
I was posting some images on a blog, and I required to post the EXIF tags info there. It was a tedious job typing all those values, and I thought then to make a app that would do this for me.
First I tried .net, then on a search came to know of the EXIF Reader available on google code.

I then created this app for reading the EXIF tags on a image file using Flex and AIR. I will be posting the step by process I used for development.

Let me know if there are any issues or suggestions....

Step One: File and Folder Selection
The first step was to allow for file and folder selection. I used the FileSystemTree Component(AIR Only) for this purpose.
I added two buttons for file and folder selection and accordingly modified the FileSystemTree.



The mxml code for this :



<mx:FileSystemTree id="fsTree" enabled="false" showIcons="true" fileChoose="onChooseFile(event)" x="10" y="36" width="482" height="460"/>
<mx:Button id="fileBtn" x="103" y="504" label="Select A File" click="openDialogFile()"/>
<mx:Button id="folderBtn" x="275" y="504" label="Select A Folder" click="openDialogFolder()"/>



The methods for the file and folder selection are:



private function openDialogFile():void{
fsTree.enumerationMode = "filesAndDirectories"
fsTree.enabled = true;
fsTree.allowMultipleSelection=true;
fileBtn.enabled = false;
folderBtn.enabled = true;
}
private function openDialogFolder():void{
fsTree.enumerationMode="directoriesOnly";
fsTree.enabled = true;
fsTree.allowMultipleSelection=false;
fileBtn.enabled = true;
folderBtn.enabled = false;
}


This allows for file and folder selection.




Wednesday, October 8, 2008

Tuesday, August 12, 2008

The Beginning

Hi,
I welcome everybody to this blog. I am planning to put some flash and flex references here. You can post your comments/ insights here.