开发者

Flex: Setting a style that is not suported by a component

开发者 https://www.devze.com 2023-01-13 22:52 出处:网络
I am not very good in \'style\' in flex. I am wondering if flex enforce style settings and throws compilation errors if a style that is applid to a component that is not supported by it. Has any one t

I am not very good in 'style' in flex. I am wondering if flex enforce style settings and throws compilation errors if a style that is applid to a component that is not supported by it. Has any one tried it be开发者_StackOverflow社区fore ?

Please help me if you have any idea in this regard.

Thanks in advance.


If you set a style that doesn't exist on a component, it is, basically, ignored by the compiler and ignored by the component at runtime. Call this:

myComponent.setStyle('MyMadeUpStyle','someValue');

Which will in turn call the styleChanged method inside the component, which will compare "MyMadeUpStyle" to the styles it knows how tohandle. If the style is not found, it calls super and is done with it. Most likely super will do nothing too.

I beleive styles were set up like this--as opposed to like properties--for convenience. Adobe didn't want to "bloat" components with dozens--if not hundreds--of extra get / set methods to support object.property notation for styles.

0

精彩评论

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