This content has been marked as final. Show 7 replies
In your custom component's definition, do you set width and height? This will lock the component to that size regardless of its children. If you don't specify width and height, the component should auto-size to fit all of its children.
When children don't fit within a Canvas's current size, it will show scrollbars by default -- but only at runtime, not at design time.
I hope that helps. If you're still having trouble, please post a brief code snippet illustrating the problem.
I don't set the width and height in the component. This is intentional so that users of the component can set it.
The image is contained within the Canvas but the canvas does not show it encapsulated within itself in the designer. In oterwords as you say, the conponent does not auto-size to fit all it's children. At leat this is not the case at design time or is diffinately not visible/obvious at design time.
I can't even see that there is an image control anywhere in the designer. No scroll bars, or any indication that it's even there. At run time the behavior is the same (or as expected), but at design time it's not the same as FB2. In my opinion (for this case) FB2 does the right thing while FB3 does not, making it impossible to use the designer for such cases.
I just tried with the following in our lastest FB 3 build:
Create a new MXML Component file based on Canvas with no width and height. When this file is open in Design view, its design area is "400 x 300" by default.
If I add an image to the file that's outside the current design area (for example in the attached code below.)
Then this image is "invisible" in design view because it's outside the design area.
If I change the design area (from the design view toolbar) to either "Fit to content" or a bigger custom size, then the image is now visible. FB would remember the previous design area setting after closing and reopening the file. That way you don't have to change the ACTUAL width/height of the Canvas but you can work with your controls.
Yes this (Fit to Content) helps in being able to see the contents of the canvas. Maybe the default for components should be fit to content? It doesn't make sense to size the design area to a specific size for controls.
I'm not sure if its a bug, feature, or just a fact of life, but I would love a way to switch a component, at runtime, from manually sized (<mx:box width="100" box.height="100">) to auto-sized based on the size of its children. Since this is the controls' behavior until such time as a fixed size is set, it should be able to revert to this. Perhaps an autoSize property, or better, separate autoSizeX and and autoSizeY properties.
Try setting explicitWidth and/or explicitHeight to NaN.