Flex Custom Component Won't Resize
I am trying to create an expanding object with the following event handler
public function pickerMove(e:MouseEvent):void {
trace("in mouse move");
var offsetX:int = e.stageX - touchX;
trace(offsetX);
picker.x += offsetX;
trace(picker.width);
picker.width -= offsetX;
trace(picker.width);
touchX = e.stageX;
}
The picker.x += offsetX works just as expected and moves the the x coordinate of the component.
The problem is with the picker.width -= of开发者_StackOverflow中文版fsetX
The width of the component doesn't change on the screen, but the value of picker.width changes as it is printed out on the console.
Here's some sample output from the trace's:
in mouse move
-1
928
929
in mouse move
-1
929
930
in mouse move
-1
930
931
Is there something that I don't know about custom components resizing?
Try to use UIComponent invalidation mechanisms and override updateDisplayList()
in your custom component to redraw your component with new width.
精彩评论