Pages

Sunday, May 18, 2008

Flex Flex Flex..

After one full year I am back in blogging.. I have been working in Flex for this whole year, and there are some things that i would like to make a note off:

1. All the Hboxes, VBoxes finally extends FlexSprite, There are two methods on it. startDrag(), stopDrag(). You can use these on MouseUp and MouseDown events for dragging and dropping of UI components.


private function initDrags():void {
setVBEvents();
}


private function setVBEvents():void {
bv.addEventListener(MouseEvent.MOUSE_DOWN, dragVB);//bv is the VBox
bv.addEventListener(MouseEvent.MOUSE_UP, dragVB);//bv is the VBox
}



private function dragVB(info:MouseEvent):void {
if (info.type == "mouseDown") {
bv.startDrag();
} else {
bv.stopDrag();
}
}


2. In Flex 3, if you want 'resize' to work, with initial flex app having width,height=0 use percentage instead. i.e. width,height=0% in the Application tag.

3. In Flex 3, if you experience problem in making DataGrids header disappear, try headerHeight=0 on creationComplete of DG.


<mx:datagrid dataprovider="{this.dataProvider}" style="font-weight: bold;">creationComplete="dg1.headerHeight=0" </span>id="dg1">
<mx:columns>
<mx:datagridcolumn datafield="time" width="50" id="u-129"> backgroundColor="#7169e1" color="white" />
<mx:datagridcolumn datafield="price" width="60" id="u-1211"> backgroundColor="#7169e1" color="white"/>
<mx:datagridcolumn datafield="qty" width="60" id="u-1213">backgroundColor="#7169e1" color="white"/>
</mx:columns>
</mx:DataGrid>

No comments:

Post a Comment