Amit Shrestha

Flex

Following  few list of flex problem’s solutions, that i encountered:

  • Asynchronous testing

http://life.neophi.com/danielr/2007/03/asynchronous_testing_with_flex.html


  • Autoscrolling

http://ntt.cc/2008/08/01/autoscrollmanager-class-scroll-scrollbar-when-mouse-is-moving-in-a-specified-area-and-mouse-button-is-down.html [Works for displayobject with baseclass as Container]

— AmitShrestha – 19 Aug 2008


  • Problem with mouseUp event:

Problem: i did as “a.addMouseListener(mouseUPEvent,function)” , i did mouse down in “a” and then mouse up “a” mouseUpEvent is fired,Now i do mouseDown in a child of “a” then drag the mouse outside of “a”[the child is dragged with mouse] then i did mouseUp , no mouse event fired:

solution : “a.systemManager.addMouseLitener(mouseUpEvent,function)”

While scrolling the datagrid label disppears and appears randomly:

if(some logic ){ statusDueDateBox.removeChild(assignedBy) }

< mx:Label text=”{‘Assigned by: ‘+ uiTask.uiTaskProgress.requester.name}” id=”assignedBy” / >

the “assibnedBy” label disappears in a radom pattern while scrolling

solution: if(some logic ){ assignedBy.text=””; }

Reason: unknown

 


  • Copying to clip Board:
System.setClipboard(richTextEditor.text);

  • Setting hand cursor
use attributes:  buttonMode="true"  useHandCursor="true"
but for labes ,text you have to do:  mouseChildren="false" buttonMode="true"  useHandCursor="true"

  • Preventing Row Highlight in a Flex DataGrid
Actionscript:

  1. /**
  2. * Override the below method:
  3. * (1) Stop the row highlight selection.
  4. */
  5. override protected function drawSelectionIndicator( indicator:Sprite, x:Number, y:Number, width:Number,
  6. height:Number, color:uint, itemRenderer:IListItemRenderer):void
  7. {
  8. super.drawSelectionIndicator(indicator, x, y, unscaledWidth – viewMetrics.left – viewMetrics.right, 0, color, itemRenderer);
  9. }

src: http://www.nutrixinteractive.com/blog/?p=300


  • changing skin of HSlider:

.volumeSlider {
thumb-skin:Embed(source=”skin_volumn_icon.gif”);
track-skin : Embed(source=”skin_slider_red.gif”);
track-height:16;
}


  • Cancelling drag drop operation when user hit’s escape

listen for key event at the main application then on key down do :

private function keyDownEvent(event:KeyboardEvent):void {
if (event.keyCode == Keyboard.ESCAPE) {
// todo
DragManager.acceptDragDrop(null);
var dragProxy: DragProxy = DragManager.mx_internal::dragProxy; // get drag proxy
if (dragProxy != null) {

dragProxy.mouseUpHandler(new MouseEvent(MouseEvent.MOUSE_UP));//provide some thing for mouse up

}
}
}

  • useful links:

sytle explorer :  http://examples.adobe.com/flex2/consulting/styleexplorer/Flex2StyleExplorer.html

http://weblogs.macromedia.com/mc/archives/FlexStyleExplorer.html

1 Response to "Flex"

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: