开发者

How to design layout in Action Script 3.0?

I want to design a registration form using only ActionScript, i have designed labels and text boxes but using label.x = "10" label.y="40" text.x = "50" text.y ="40"... to align correctly. But i want to design a layout such that all labels and text boxes will be aligned prop开发者_JS百科erly. Any Help or examples or Docs ?


If you use Flex you can use HBox/VBox and set dimensions in percent. Otherwise you could create a helper class (like PositionUtils) that could help you out.

// position the displayobjects in list with margins 0, 5 and 10
PositionUtils.alignVertical([txtHeader,txtBody, btnSend], [0,5,10]); 


If you do it in AS3 only, without frameworks , you may consider creating your own components.

You could create a FormField class , which would at the minimum contain a TextField for the label, and a TextField for the text input. Create a params setters , which would help you customize various aspects such as the margin between the label & the textInput, text colors, background color, font , textformat etc...

For a registration form , create several fields and you'll simply have to set either the x or the y value for each field & they will naturally align.


Try AS3Commons UI Layouts. This is a pure AS3 library I am developing exactly for that purpose.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜