[备忘] Flex mxml中不能直接用getStyle(someColorStyle)

[Style(name="someColor", type="uint", format="Color", inherit="no")]

class com.xxx.SomeHostComponent{

}

SomeSkin.mxml:

<fx:Metadata>    
<![CDATA[        
[HostComponent("com.xxx.SomeHostComponent")]    
]]>
</fx:Metadata> 
...
<xxxx> 
<s:SolidColor color="{getStyle('someColor')}" /> <!-- 这里, 象这样用是个杯具 -->
</xxxx>

...

问题本质是getStyle('someColor') 返回的是String, 而 SolidColor.color是uint, 有一个mxmlc自动的数据类型转换,

如果你将 someColor的值写成 "#FF0000", 或是 "red"之类的, 就会形成了杯具, 如果你写成 "0xFF0000" 就可以.

smithfox | Monday 31 January 2011 at 11:10 am | | UI        | Used tags: , , ,

two comments

Leather iPhone 6 Plus Cases

Some of you might be thinking, isn’t it going to be called the iPhone 6S next? After all, Apple has released an iPhone 3G, iPhone 3GS, iPhone 4, iPhone 4S, iPhone 5, iPhone 5S and now iPhone 6 . So if history repeats itself, it’s likely that the next iPhone will be called the iPhone 6S rather than the iPhone 7.

Leather iPhone 6 Plus Cases, (URL) - 04-06-’15 12:45
Chanel Handbag 2015

The prices of three classic Chanel bags — the 11.12, the 2.55, and the Boy Bag — will increase by 20 percent in Europe (except for the U.K.), but also go down by the same percentage in Asian countries like China

Chanel Handbag 2015, (URL) - 06-07-’15 18:12
(optional field)
(optional field)
为阻止垃圾广告, 请在提交评论前, 回答一个简单问题(Please answer an simple question)
Remember personal info?
Notify
Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.