I have a custom ActionScript component that I'm using in a Flex application (Flex 3.3, ActionScript 3). This component contains an Image control whose visibility is set dynamically based on a property of the data
element provided to the component.
The problem is that even when I set the image to be visible, it will not render onscreen. Is there something specific I need to do in order for the image to render? Snippets of relevant code below:
override public function set data( value:Object ):void
{
_data = value;
if( _data ) {
if( _myImg ) {
_myImg.source = someImageClass;
_myImg.visible = _data.visibilityProperty;
_myImg.includeInLayout = _data.visibilityProperty;
_myImg.invalidateProperties();
_myImg.invalidateDisplayList();
}
}
invalidateProperties();
invalidateDisplayList();
}
override protected function createChildren():void
{
super.createChildren();
if( !_myImg ) {
_myImg = new Image();
_myImg.height = 16;
_myImg.width = 16;
addChild( _myImg );
}
}
override protected function updateDisplayList( unscaledWidth:Number, unscaledHeight:Number ):void
{
super.updateDisplayList( unscaledWidth, unscaledHeight );
_myImg.x = calculatedXCoordinate;
_myImg.y = calculatedYCoordinate;
}