1

Flash builder 4.6 を使用して携帯電話 (android) 用の辞書プログラムを開発しようとしています。

問題は、検索ボタンが機能していないことです。さまざまなコードを試しましたが、成功しませんでした。また、フラッシュプログラミングは初めてです

このxmlファイルは長いですが、読みやすくするために縮小する必要があることに注意してください

これは私のxmlファイルです:


<list>
    <Dictionary>
              <id>1</id>
              <term>ok</term>
              <defin>Advanced Audio Coding</defin>
</Dictionary>
<Dictionary>
<id>6</id>
<term>absolute address</term>
<defin>a fixed location in the computer's memory.</defin>
</Dictionary>
<Dictionary>
<id>7</id>
<term>absolute URL</term>
<defin>a URL that contains </defin>
</Dictionary>

ホーム ビュー コード:


    <?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" title="Home"
                    creationComplete="srv.send()">

          <fx:Declarations>

                    <s:HTTPService id="srv" url="assets/Dictionary.xml"
                    result="data=srv.lastResult.list.Dictionary"/>                                         
          </fx:Declarations>
          <s:titleContent>
                    <s:TextInput id="key" width="100%"/>
          </s:titleContent>

          <s:actionContent>
                    <s:Button icon="@Embed('assets/search.png')" click="srv.send()"/>
          </s:actionContent>
          <s:List id="list" top="0" bottom="0" left="0" right="0"
                              dataProvider="{srv.lastResult.list.Dictionary}"
                              labelField="term"
                              change="navigator.pushView(Details, list.selectedItem)">
          </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"
                    title=" {data.term}">
          <fx:Declarations>
                    <!-- Place non-visual elements (e.g., services, value objects) here         -->
          </fx:Declarations>
          <s:actionContent>
                    <s:Button label="BACK" click="navigator.popToFirstView()"/>
          </s:actionContent>
          <s:TextAreatext="{data.defin}"  />
</s:View>

前もって感謝します

4

1 に答える 1

0

まず、結果の2倍を待機します(リスト内のデータバインディングと結果イベントを使用)。結果イベントを削除します。また、XMLファイルをタグで閉じることを忘れないでください。

<s:View xmlns:fx="http://ns.adobe.com/mxml/2009" 
    xmlns:s="library://ns.adobe.com/flex/spark" title="HomeView">
<fx:Declarations>
    <!-- Place non-visual elements (e.g., services, value objects) here -->
    <s:HTTPService id="srv" url="myData.xml"/>
</fx:Declarations>
<s:titleContent>
    <s:TextInput id="key" width="100%"/>
</s:titleContent>

<s:actionContent>
    <s:Button  label="search" click="srv.send()"/>
</s:actionContent>
<s:List id="list" top="0" bottom="0" left="0" right="0"
        dataProvider="{srv.lastResult.list.Dictionary}"
        labelField="term"
        change="navigator.pushView(Details, list.selectedItem)">
</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" title="Details">
<fx:Declarations>
    <!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:actionContent>
    <s:Button label="BACK" click="navigator.popToFirstView()"/>
</s:actionContent>
<s:TextArea text="{data.defin}"/>
</s:View>
于 2012-12-10T08:36:33.910 に答える