Tuesday, 18 September 2012

ItemRenderer For RowNumber



<?xml version="1.0" encoding="utf-8"?>
<s:GridItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009" 
                    xmlns:s="library://ns.adobe.com/flex/spark" 
                    xmlns:mx="library://ns.adobe.com/flex/mx" clipAndEnableScrolling="true">

    <fx:Script>
        <![CDATA[

        ]]>
    </fx:Script>

    <s:Label id="lblData" top="9" left="7" text="{this.rowIndex+1}"/>

</s:GridItemRenderer>


Set Focus During Page Load Flex


The issue is that within your application the TextInput has focus, but within the HTML page your Flex application does not. So basically the only extra step you need is to give the Flex app focus. There's only one way to achieve this: through JavaScript. And you should do it after the application was loaded.
The guys at Farrata wrote a very good example on how to do this, so I'm just going to point you there:http://flexblog.faratasystems.com/2011/12/15/setting-focus-in-flex-components

Flex formatting byte to MB, GB, TB, etc.

 labelFunction IS:


<mx:AdvancedDataGridColumn width="80" dataField="totalunpublished" headerText="Photo Usage" labelFunction="convertSize"/>

private var _levels:Array = [ 'bytes','Kb','MB','GB','TB','PB','EB','ZB','YB'];
private function convertSize(data:Object, column:AdvancedDataGridColumn):String {
     var bytes:Number=data[column.dataField];
    var index:uint = Math.floor(Math.log(bytes) / Math.log(1024));
    return (bytes / Math.pow(1024, index)).toFixed(2)+" "+this._levels[index];
}

Login With Remember Password

This will store user name and passwords in shared objects.
drawback is it will not encrypt while storing data.
Login using Shared Objects