开发者

What is the purpose of 'fb:purpose' in a Flex <fx:Script>?

开发者 https://www.devze.com 2023-01-28 11:09 出处:网络
I\'ve now seen it a few times here and there and it\'s got me curious. <fx:Script fb:purpose=\"styling\">

I've now seen it a few times here and there and it's got me curious.

 <fx:Script fb:purpose="styling">
    //script stuff
 </fx:Script>

So far, I have seen no difference with it there and without it. Nor do I get any compiler erros. How does a script with fb:purpse differ from a script without? What 开发者_如何学运维are the consequences for not including a fb:purpose and what are the benefits for including a fb:purpose?


From the Flex 4 documentation:

Most Spark skins have a special block at the top of the skin class. This block typically defines style properties that the skin class respects, including the exclusions that the skin uses. The tag includes a special attribute, fb:purpose="styling":

<fx:Script fb:purpose="styling">

This attribute is used by Flash Builder. When you create a copy of a skin class in Flash Builder, you can opt to make the skin styleable. If you choose to make it styleable, Flash Builder includes this section of the skin class. If you choose not to make the skin styleable, Flash Builder excludes this section.


It's part of the flashbuilder namespace, and won't have any effect on compilation.

There's no documentation for it that's publicly available at the moment, but it's usually generated by FlashBuilder itself, or is included in the Flex framework code from Adobe.

It's used to show the purpose (in a tool readable manner) of a script block, in this case, styling.


If you create a new MXML Skin using Flash Builder (File > New > MXML Skin) you can deselect the "Remove ActionScript styling code" checkbox which signifies that Flash Builder should remove the script block that defines fb:purpose="styling".


As Yaba said, it allows you to check or uncheck "Remove ActionScript Styling" when building a new MXML skin by copying another Skin class.

0

精彩评论

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

关注公众号