0

我正在构建一个应用程序。第一页有一个从本地 xml 生成的列表,当您在该列表中选择房间类型时,它会推送所选项目下的节点;标题页、页面图像和该房间中的新产品列表到第二页上的另一个列表。

页面标题和页面图像很好,但只有“item_name”列表中第一个节点的产品列表是从第一页的第一个项目(room_name)推送的。

出现这样的错误:此行有多个标记:-使用方括号运算符时,数据绑定将无法检测到更改。对于 Array,请改用 ArrayCollection.getItemAt()。-行断点:fob.mxml [行:35]

我知道我会再次处理这个问题,因为我想将该选项中的信息推送到包含该项目信息的第三页。

这是第一页: `

        import mx.events.FlexEvent;

        import spark.events.IndexChangeEvent;

        protected function list_creationCompleteHandler(event:FlexEvent):void
        {
            getDataResult.token = macysmain.getData();
        }

        protected function list_changeHandler(event:IndexChangeEvent):void
        {
            navigator.pushView(fob, event.target.selectedItem);
        }

    ]]>
</fx:Script>
<fx:Declarations>
    <s:CallResponder id="getDataResult"/>
    <macysmain:Macysmain id="macysmain"/>
    <!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:Image left="10" right="10" top="10" height="40%" smooth="true" source="assets/visual merc.png"/>
<s:List id="list" left="10" right="10" bottom="10" height="55%"
        change="list_changeHandler(event)"
        creationComplete="list_creationCompleteHandler(event)" fontFamily="_sans" fontSize="35"
        labelField="room_name">
    <s:AsyncListView list="    {TypeUtility.convertToCollection(getDataResult.lastResult.room)}"/>
</s:List>
</s:View>`

第二页(我把 ??? ??? 放在有问题的行周围:

<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:s="library://ns.adobe.com/flex/spark"
    xmlns:macysmain="services.macysmain.*"
    title="{data.room_name}">

<fx:Script>
    <![CDATA[
        import com.adobe.serializers.utility.TypeUtility;

        import mx.events.FlexEvent;
        protected function button1_clickHandler(event:MouseEvent):void
        {
            navigator.popView();
        }

        protected function        list_creationCompleteHandler(event:FlexEvent):void
        {
            getDataResult.token = macysmain.getData();
        }

    ]]>
</fx:Script>

<fx:Declarations>
    <s:CallResponder id="getDataResult"/>
    <macysmain:Macysmain id="macysmain"/>
    <!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:actionContent>
    <s:Button label="Back" click="button1_clickHandler(event)"/>
</s:actionContent>
<s:List id="list" left="10" right="10" bottom="10" height="55%"
        creationComplete="list_creationCompleteHandler(event)" fontSize="35"
        labelField="item_name">
    ?????????<s:AsyncListView list="    {TypeUtility.convertToCollection(getDataResult.lastResult.room[0].item_list.item)}"/>?????????
</s:List>
<s:Image id="roompic" top="50" width="750" height="325" horizontalCenter="0" smooth="true"
         source="{data.room_image}"/>
</s:View>

我处于非常基础的水平。非常感谢您的任何帮助。

4

1 回答 1

0

我对 FlexBuilder 一无所知,但根据错误消息,我建议您将麻烦的行编辑为:

<s:AsyncListView list="{TypeUtility.convertToCollection(getDataResult.lastResult.room.getItemAt(0).item_list.item)}"/>
于 2013-01-29T21:40:31.210 回答