Flex Builder defaults some components to "fit to content" if you don't specify a set width or height. I'm trying to fill a mx:Tile component with Actionscript, but the layout has some strange spacing when I don't specify the width of a component I add to it. Is there a way to set the components to "fit to content" using Actionscript?
如果未指定设置的宽度或高度,Flex Builder会将某些组件默认为“适合内容”。我正在尝试用Actionscript填充mx:Tile组件,但是当我没有指定我添加到它的组件的宽度时,布局有一些奇怪的间距。有没有办法使用Actionscript将组件设置为“适合内容”?
2 个解决方案
#1
Do you still need the tiles to align in columns/rows, or do you want them all to be fit-to-content? If you want the former, good luck, and I hope someone else can answer for my benefit. If you want the latter, you could use FlowContainer (which I got from Appdivision).
你是否仍然需要瓷砖在列/行中对齐,或者你是否希望它们都适合内容?如果你想要前者,祝你好运,我希望别人可以为我的利益回答。如果你想要后者,你可以使用FlowContainer(我从Appdivision获得)。
#2
// AS3 way
var c:UIComponent = <your component that should fit into parent's content>;
c.percentWidth = 100;
c.percentHeight = 100;
// MXML way
<mx:Canvas>
<mx:Button id="c" width="100%" height="100%"/>
</mx:Canvas>
#1
Do you still need the tiles to align in columns/rows, or do you want them all to be fit-to-content? If you want the former, good luck, and I hope someone else can answer for my benefit. If you want the latter, you could use FlowContainer (which I got from Appdivision).
你是否仍然需要瓷砖在列/行中对齐,或者你是否希望它们都适合内容?如果你想要前者,祝你好运,我希望别人可以为我的利益回答。如果你想要后者,你可以使用FlowContainer(我从Appdivision获得)。
#2
// AS3 way
var c:UIComponent = <your component that should fit into parent's content>;
c.percentWidth = 100;
c.percentHeight = 100;
// MXML way
<mx:Canvas>
<mx:Button id="c" width="100%" height="100%"/>
</mx:Canvas>