Flex的CSS不支持对齐操作? [英] Flex CSS does not support align manipulation?

查看:176
本文介绍了Flex的CSS不支持对齐操作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Flex 4.9。我想用最新的SDK,他们终于取得了Flex和CSS组件标签的工作。但他们没有这样做。

I am using Flex 4.9. I thought that with the newest SDK, they finally made Flex and CSS components tags to work. But they did not.

我试图设置horisontalAlign和火花HGroup的verticalAlign争夺CSS样式,这样我就可以顺利地进行管理和节省一些code打字。 HGroups didnt回应我申请了,好了,我想,至少我会设置它们的宽度CSS样式。它也没有工作!也不像素宽度或百分比值。

I tried to set horisontalAlign and verticalAlign of spark HGroup vie CSS style, so I could manage it smoothly and save some code typing. HGroups didnt respond to CSS style I applied, ok, I thought that at least I will set their width. It also did not work! Nor pixel width or percent value.

请问Flex的CSS样式确实是这样有限的还是我失去了一些东西?

Does Flex CSS styling is really so limited or am I missing something?

推荐答案

horizo​​ntalAlign verticalAlign 宽度高度全部的属性HGroup类的,不会的的样式的。因此,你无法通过样式表设置这些属性。

horizontalAlign, verticalAlign, width and height are all properties of the HGroup class, not styles. Hence you cannot set these properties through stylesheets.

你似乎什么缺少的是,Flex是不是HTML和相同的语义并不适用。在Flex 4,我们分开的方式,内容是psented主要是通过这个过程称为蒙皮$ P $:我们声明组件以及它们在同一个类(通常在ActionScript)的逻辑,我们定义它的视觉重新presentation在另一个(通常用MXML)。
与已经这种分离的地方,几乎没有任何必要的样式表。事实上,如果你把一个CSS最重要的是,你会有种人为地尝试布局分隔成两个独立的实体而没有太大的意义。更何况这将使code更难阅读。

What you seem to be missing is that Flex is not HTML and that the same semantics do not apply. In Flex 4 we separate the content from the way it is presented mainly through a process called skinning: we declare components and their logic in one class (usually in ActionScript) and we define its visual representation in another (usually written in MXML).
With this separation already in place there is hardly any need for stylesheets. In fact, if you would put a CSS on top of that, you would kind of artificially try to separate the layout into two separate entities which doesn't make much sense. Not to mention it would make the code much harder to read.

还有就是CSS就派上用场了,虽然情况下,那就是当你希望能在您的应用程序施加一定的视觉风格。一个按钮可以有五种不同的皮肤,而是通过CSS,你可以将所有五到特定颜色的字体颜色不重复,在每个皮肤。

There is a case where CSS comes in handy though, that is when you want to apply a certain visual style throughout your application. A Button could have five different skins, but through CSS you could set the font color of all five to a specific color without repeating that in each skin.

这篇关于Flex的CSS不支持对齐操作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆