开发者

FlexLib Windowshade and Flex 4

I'm trying to build a collapsible panel in Flex 4. I thought I'd use s/thing like this:

<s:Panel
    width="100%">

    <s:controlBarContent>

            <flexlib:WindowShade
                width="100% />

    </s:controlBarContent>

</s:Panel>

But that throws an error: Instantiation attempted on a non-constructor. I grabbed the flexlib zip for flex 4 but I'm still getting that error.

Is there another way to开发者_运维知识库 create a collapsible panel in a control bar?

Thank you for any tips!


You need to define the header renderer or header Class for the WindowShade component. Looking at their code where this exception occurs Exception is:

TypeError: Error #1007: Instantiation attempted on a non-constructor.
at flexlib.containers::WindowShade/createOrReplaceHeaderButton()[...\src\flexlib\containers\WindowShade.as:258]

The code that throws exception is this

        if(_headerRenderer) {
            _headerButton = _headerRenderer.newInstance() as Button;
        }
        else {
            var headerClass:Class = getStyle("headerClass");
           _headerButton = new headerClass();
        }

You need to define either a headerClass or a headerRenderer. For testing purposes i used

    <s:Panel
    width="100%">

    <s:controlBarContent>

        <containers:WindowShade headerClass="mx.controls.Button"
            width="100%" />

    </s:controlBarContent>

</s:Panel>

and it works like a charm :)

Have fun and good luck.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜