views:

473

answers:

2

Hi all! I have a flex application and I want to add a new custom component with action script at runtime. This works fine. I have created my custom component and added the following code:

var freeView:FreeView=new FreeView();
freeView.setStyle("showEffect",this.fadeIn);
freeView.setStyle("hideEffect",this.fadeOut);
freeView.visible=false;
this.addChild(freeView);
freeView.visible=true;

But my problem is the fade in effecto is not working. I know I've declared the effect correctly because if I use it in another component (like a panel) it works fine. Can anybody help me with this issue? Best regards!

A: 

Ensure that you call any overridden Flex super-functions in your FreeView subclass.

Especially updateDisplayList and commitProperties:

override protected function updateDisplayList(w:Number, h:Number)
{
    super.updateDisplayList(w, h);

    // Your code here.
}


override protected function commitProperties()
{
    super.commitProperties();

    // Your code here.
}

Are you overriding one of the high-level container classes (e.g. Canvas or HBox) or UIComponent?

Sly_cardinal
A: 

Finally I solve the problem in a different way. Instead adding the component at run time I have added the component to the application with visible property set to false and I change it to true when I need.

Kezern