0

Why does the following button not line up 100px from the left edge?

<mx:Button left="100"></mx:Button>

I am using the Flex 4(Gumbo) SDK, I am pretty sure that if you try to do it in FlashBuilder, it would work.

sigvardsen
  • 1,531
  • 3
  • 26
  • 44

2 Answers2

1

Check if you have it nested in some other component.

In this example button will be placed 200px left (100px for panel + 100px button for button left attribute)

<s:Panel x="100" y="100" width="250" height="200">
    <mx:Button left="100"></mx:Button>
</s:Panel>
dd .
  • 572
  • 2
  • 13
  • 28
  • nested? Could you please explain, It is the only component in the application so far. – sigvardsen Sep 14 '09 at 14:13
  • This is my entire application: This is my output file: http://sitoon.com/labs/isoperior.swf – sigvardsen Sep 14 '09 at 14:22
  • I assume nested is asking if you happen to have the component inside a "Canvas" or something similar. If you are on a relative layout, or using relative layout for that specific control, then it will be 100 away from the canvas, rather than the side of the window. – Sivvy Sep 14 '09 at 14:25
  • You have the button embedded in a panel. It's relative to the Panel's position. Change it to absolute, or make it "0" relative to the panel. – Sivvy Sep 14 '09 at 14:26
1

Are you using absolute or relative layout?

<mx:Application Layout="absolute">

And if trying either of those doesn't work... I don't think I've ever seen someone use "left" (I'm sure it works, but it looks odd to me). Try changing "left" to "x":

<mx:Button x="100" />
Sivvy
  • 853
  • 9
  • 28
  • Thank you, it works. I agree that using it for left is odd, but it is practicle for a resizable application, when using left, right, top, bottom. – sigvardsen Sep 14 '09 at 14:26
  • Remember... It works, but it depends if that's how you want ALL the components to act. If you have controls within a panel of canvas, all controls will be placed according to the absolute value, rather than relative to the parent component. – Sivvy Sep 14 '09 at 14:30