-2

还尝试将其添加到 NavigatorContent类中。当我分配数据提供者时,火花列表的默认皮肤仍然为空,因此出现错误。

现在作为背景,我正在使用自定义树,它在使用所有 Mx 组件的旧项目中扩展 Spark 列表。

它是一个包含许多使用 RSL 设置的库项目的项目。使用 SDK 4.6。

这是添加火花树的代码。

<skins:VBox left="5" top="5" right="15" verticalGap="1" id="topBox">
            <skins:HBox id="topBar" width="100%">
                <skins:Label id="titleLabel" text="{this._headerText}"
                             styleName="leftPanelPopUpTitleLabel" />
                <skins:Spacer width="100%" />
                <skins:LinkButton label="Cancel" click="this.close();"
                                  styleName="linkButtonStyle" />
            </skins:HBox>
            <skins:Label id="featureName"
                         text="{this._feature.getNameFromDdctType()}"
                         styleName="labelID" />
            <skins:Label id="featureID" text="{this._feature.getId()}"
                         styleName="leftPanelPopUpTitleLabel" />
        </skins:VBox>

        <skins:VBox id="treeBox" bottom="0" left="0" right="0"
                    top="{topBox.height+5}" height="{topBar.height + 5}">
            <skins:HBox id="dropBox" left="5" top="30" right="15">
                <skins:ComboBox id="itemsToAdd" selectedIndex="0" />
                <skins:Button id="clickToAdd" label="Add"
                              click="addParentAttributeNode()" />
            </skins:HBox>
            **<sparkTree:Tree id="attributesTree" width="100%" height="100%"
                            indentation="15" />**
            <!-- Bottom Gray Box starts-->
            <skins:VBox backgroundColor="#EBEBEB" height="68" width="100%"
                        bottom="0" verticalGap="5" paddingTop="3" paddingRight="5"
                        paddingLeft="5" paddingBottom="3">
                <skins:HBox horizontalGap="5" width="100%">
                    <skins:LinkButton id="templatesButton" label="SelectedTemplate"
                                      styleName="linkButtonStyle" width="95" />
                    <skins:InvisibleCanvas height="20" width="2">
                        <skins:Image 
                                     source="@Embed(source='Images/vertical-separator.png')" />
                    </skins:InvisibleCanvas>
                    <skins:LinkButton id="applyTemplateButton"
                                      label="Apply template"
                                      styleName="linkButtonStyle" width="95" />
                    <skins:InvisibleCanvas height="20" width="2">
                        <skins:Image 
                                     source="@Embed(source='Images/vertical-separator.png')" />
                    </skins:InvisibleCanvas>
                    <skins:LinkButton id="editTemplatesButton"
                                      label="Template Editor"
                                      styleName="linkButtonStyle" width="95" />
                </skins:HBox>
                <skins:HRule width="100%" strokeColor="#FFFFFF" />
                <skins:HBox horizontalGap="8" width="100%">
                    <skins:ColoredButton id="OkButton" label="OK" />
                    <skins:ColoredButton id="cancelButton" label="Cancel"
                                         fillColor="0xcc3333" />
                    <skins:Button id="applyButton" label="Apply"
                                  click="applyChanges()" />
                    <skins:Spacer width="100%" />
                    <skins:HBox id="copyPasteHBox" horizontalGap="0"
                                paddingRight="9" backgroundAlpha="0"
                                disabledOverlayAlpha="0">
                        <skins:Button height="23" width="20" skin='{null}'
                                      toolTip="Copy" id="btnCopy"
                                      chromeColor="#E4E4E4" />
                        <skins:Button height="23" width="20" skin='{null}'
                                      paddingLeft="15" toolTip="Paste" id="btnPaste"
                                      tabEnabled="false" tabFocusEnabled="false"
                                      enabled="false" />
                    </skins:HBox>
                </skins:HBox>
            </skins:VBox>
            <!-- Bottom Gray Box ends-->
        </skins:VBox>

    </skins:Canvas>

它还使用 this.viewstack.addChild(component) 添加到 as3 中。可能是 sparkskins.swc 没有正确连接到插件。如果是,如何解决这个问题。

4

1 回答 1

0

我们需要更多详细信息(代码、日志..)来帮助您解决这个问题!

首先,不能在 ViewStack 中添加 List 组件,必须先在 NavigatorContent 中添加列表,看这个例子:

<mx:ViewStack id="viewStack"
              width="100%" 
              height="100%"
              creationPolicy="auto">

    <s:NavigatorContent>
        <s:List height="100%"
                width="100%"/>
    </s:NavigatorContent>

    <s:NavigatorContent>
        ...
    </s:NavigatorContent>
    ...
</mx:ViewStack>

然后,对于空指针异常,它可能是由于运行时缺少 swc lib 引起的,因此请确保从项目设置面板中禁用 RSL 功能,然后重试。

如果错误仍然存​​在,请分享您的错误代码,以便我们与您一起测试。

于 2014-09-03T11:31:50.337 回答