0
votes

I have a canvas component that I create and add as a child of a parent canvas component. I set the opaqueBackground property for the child component which makes it opaque over the parent component. However, when I add two child components, they are not opaque over each other. How do I set it up so that one child component completely covers up the other child component?

1

1 Answers

1
votes

First thought:

1) Are you using cacheAsBitmap? opaqueBackground is designed for use with cacheAsBitmap in order to improve rendering. If you just want to make something transparent, would alpha work better for you?

Second thought:

2) Styles are inherited, but properties generally aren't. If you want to pass the property value onto one of a component's children, override the property set method to set a flag and invalidateProperties(). Then use commitProperties() to set your children.

Third thought:

3) It sounds like you may want only one child active at once. Perhaps you want to look into using the visible property or a ViewStack or states?