开发者

How do you declare component states in ActionScript?

In mxml you declare states like this:

<box:states>
    <s:State name="active"/>
    <s:State name="disabled"/>
</box:states>

How do you acheive the same in an A开发者_如何学JAVActionScript class? Apparently it's the same in Flex 3 and Flex 4, whatever it is.


If you can avoid it, do!

That said, hold your breath!

That said, take a look at the State Class. Create a new instance and define the overrides. I believe all the overrides are link in the "see also" link.

Each component has a "states" array.

So, just create the states manually. Add the relevant overrides, and add that state to the states array.

It isn't hard, but it can be pretty tedious. I did this for the Flextras Calendar.


Thanks for the answers. Here's what I came up with:

// constructor
public function MyBox() {
    states = new Array();

    for each (var name:String in ['working', 'active', 'disabled']) {
        var state:State = new State();
        state.name = name;
        states.push(state);
    }
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜