0

電卓名の配列コレクションを持つアプリケーションがあります。選択したら、そのアイテムの電卓の実際のビューをプッシュしたいと思います。

これが私のコードです 誰かがこれを可能にする関数を書くのを手伝ってくれますか?

<?xml version="1.0" encoding="utf-8"?>
    <s:View xmlns:fx="http://ns.adobe.com/mxml/2009" 
title="iCalculate"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
creationComplete="creationCompleted(event)"
width="100%" height="100%">

       <s:layout>   
    <s:VerticalLayout paddingTop="10"/>
   </s:layout>
<fx:Script>
    <![CDATA[
        import com.Watts.collections.filter.Evaluator;
        import com.Watts.demo.Album;

        import mx.collections.ArrayCollection;
        import mx.events.CollectionEvent;
        import mx.events.FlexEvent;
        import mx.rpc.http.Operation;

        import spark.components.Image;
        import spark.components.ViewMenu;
        import spark.components.gridClasses.GridColumn;
        import spark.events.IndexChangeEvent;
        import spark.events.TextOperationEvent;

// Everything Below this line holds information specifically relating to Beta 2

// Below this line is the coding for the search bar or filter bar 
        private var _collection:ArrayCollection;
        private var _evaluator:Evaluator = new Evaluator();

        private function creationCompleted(event:FlexEvent):void
        {
            _collection = Album.collection;
            _collection.filterFunction = filterCollection;

            _evaluator.synonyms["four"] = new ArrayCollection(["4"]);

            grid.dataProvider = _collection;
        }

        private function filterChanged(event:Event):void
        {
            update();


        }

        private function update():void
        {
            _evaluator.prepare(filter.text);
            _collection.refresh();

            formula.text = (_evaluator.tree) ?                              _evaluator.tree.toString() : "";

        }

        private function filterCollection(data:Object):Boolean
        {
            var labels:ArrayCollection = new ArrayCollection();
            for (var i:int; i < grid.columns.length; i++)
            {
                labels.addItem((grid.columns.getItemAt(i) as GridColumn).itemToLabel(data));
            }   
            return _evaluator.evaluate(labels);
        }

    ]]>
</fx:Script>


    <s:VGroup left="5" right="-9" top="5" bottom="5" width="100%" height="100%" textAlign="center">
    <s:TextInput id="filter" width="100%" change="filterChanged(event)"/>
    <s:DataGrid id="grid" width="100%" height="100%" textAlign="left">
    </s:DataGrid>
    <s:Label id="formula" />
    </s:VGroup>
    <s:Label id="lblWattsMessage" click="navigator.pushView(views.CompanyDetail)" color="#1021C7"
         fontFamily="_typewriter" fontSize="12" text="Powered by WATTS Professionals"
         textAlign="center" verticalAlign="middle"/>



</s:View>
4

1 に答える 1

2

この問題を修正するために使用したコードを次に示します。フレックス アプリケーション内には、使用できる navigator.pushView コンポーネントがあります。私が抱えていた問題は、各電卓にビュー ID を割り当てなかったことです。これは、ArrayCollection コンテナで行う必要があります。

navigator.pushview( ViewID )

于 2013-03-22T06:54:51.437 に答える