深深吸引我的Flex

來源:互聯網
上載者:User

       前兩天在cnblog上看到一個關於Flex的貼子,沒想到出於好怪心試用了一下確被它深深地吸引了。無論是UI美觀上或資料交換上都讓我感覺非常不錯,提供了remoting, HTTPService, WebService等組件靈活地和其他平台進行資料交換;基於動態類型的指令碼使用起來也很方便。Flex Builder2提供協助文檔也非常不錯,可惜全是英文看得比較辛苦(本人英文水平差)

       大概花了一天的時間使用了一下,其實使用也很簡單。分別寫了一些使用HTTPService和WebService的例子。不過下面介紹的是如果建立一個美觀的DropDownList,先看一下:



Flex提供的控制項模型在建立這些群組控制項時非常簡單(可以說簡單到你不信)。看下整個mxml檔案的代碼:

<?xml version="1.0" encoding="utf-8"?>

<mx:Application initialize="OnInit()"   xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">

        <mx:Script>

        <![CDATA[

               import mx.rpc.soap.WebService;

               import mx.rpc.http.HTTPService;

          

            public var initDG:Array = [

                {Artist:'Pavement', Album:'Slanted and Enchanted', Price:11.99},

                {Artist:'Pavement', Album:'Brighten the Corners', Price:11.99}

            ];

           

            function OnInit():void

            {

                   removeChild(myGrid);

                   SelectItem.popUp=myGrid;

                  

            }

            function ItemChange():void

            {

                   SelectItem.label= myGrid.selectedItem.Album;

            }

        ]]>

    </mx:Script>

 

    <mx:DataGrid id="myGrid" dataProvider="{initDG}"  x="10" y="40"  change="ItemChange()" width="326" height="126">   

        <mx:columns>

            <mx:DataGridColumn dataField="Artist"/>

            <mx:DataGridColumn dataField="Album"/>

            <mx:DataGridColumn dataField="Price"/>

        </mx:columns>   

    </mx:DataGrid>  

    <mx:PopUpButton x="10" y="10" id="SelectItem"/>

 

</mx:Application>

 

實上可以通過HTTPService,WebService等組件和資料庫資料進行綁定,還可以加上靈活的資料過慮功能。

有時間寫一些關於如果調用WebService進行資料查詢,並綁定顯示結果。

如果對Flex有興趣的朋友可以瞭解一下,不會花太長時間就會有收穫。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.