Reputation: 1469
The code below works. However, If I change the container in the component from a Canvas to a UIComponent the Canvas inside the container does not show. Why is this the case?
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:local="*">
<local:Comp />
</mx:Application>
Comp.mxml
<mx:Canvas xmlns:mx = "http://www.adobe.com/2006/mxml" buttonMode="true" useHandCursor="true" >
<mx:Canvas width="100" height="100" backgroundColor="0xffff00" />
</mx:Canvas>
Upvotes: 0
Views: 125
Reputation: 39408
Because the UIComponent does not implement a measure() or updateDisplayList() method, and therefore your component is never given a size; thus there is no visual display area for the child component to be shown.
Please read up on the Flex Component LifeCycle
Upvotes: 1
Reputation: 68
Here is the quotation from the UIComponent spec:
The UIComponent class is not used as an MXML tag, but is used as a base class for other classes.
For details, see UIComponen specification here: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/core/UIComponent.html
Upvotes: 0