开发者

Flex 3: "y" not having any effect on an image

In one of my children, I have the following code:

<mx:Canvas id="projWrapper" x="{parentApplication.oneDay * startOffset}" width="{parentApplication.oneDay * numDays}" height="26" backgroundColor="{conflictBG}" borderColor="#000000" borderSides="bottom top left right" borderStyle="solid" borderThickness="1">
    <mx:HBox verticalGap="0">
        <mx:Image id="expandBlockLeft" source="images/addRed.png" y="5" />
        <mx:Text id="sNameShow" text="{sName}" />
    </mx:HBox>
</mx:Canvas>

the image, which is a small plus ("+") sign, is starting at coordinate 0, 0 of the canvas. I need it to start at 0, 5... however, no matter what I change the y value to, the plus sign doesn't move.

I know this 开发者_Python百科seems simple, and I'm sure it is, but I can't figure it out for the life of me.

If anybody can shed some light onto my little issue here, it'd be greatly appreciated.


Try to use:

<mx:Canvas id="projWrapper" x="{parentApplication.oneDay * startOffset}" width="{parentApplication.oneDay * numDays}" height="26" backgroundColor="{conflictBG}" borderColor="#000000" borderSides="bottom top left right" borderStyle="solid" borderThickness="1">
    <mx:HBox verticalGap="0" paddingTop="5">
        <mx:Image id="expandBlockLeft" source="images/addRed.png" />
        <mx:Text id="sNameShow" text="{sName}" />
    </mx:HBox>
</mx:Canvas>

The problem is HBox layout container doesn't support custom precise positioning with x and y and response for the positioning itself (by design). You can use gaps, paddings and align to have some custom adjustments or use container with absolute positioning like Canvas.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜