Flex實現在ViewStack中的滾動新聞即時重新整理(上)!

來源:互聯網
上載者:User

      先描述一下作品的需求:

      滾動新聞作為當前ViewStack的其中一頁,要實現定時重新整理。

      單純的滾動新聞效果,相信大家都很容易實現,不過就是通過設定Move的一些屬性罷了,

 

       //滾動字幕
         private function moveAction():void{
          
              if(recordsNum>DEFAULT_SCROLL_ROWNUM){
               
                 move_up.end();        //這句話 最好加 否則會在HttpService重新整理資料時 產生其他效果
               
                 move_up.yFrom = 0;  

                

                 move_up.yTo =  0-AbfltDG.height;
 
                 move_up.repeatCount = 0; //loop
 
                 move_up.repeatDelay = 0; //loop time
 
                 move_up.duration = SPEED_SCROLL*recordsNum; //the time of scroll once  其中SPEED_SCROLL、

 

                                                                                                    recordsNum都是自訂的變數Number類型
 
                 move_up.play();
                
               
              }

         }

 

<!--相應頁面元素-->

<mx:Move id="move_up" target="{AbfltDG}"/>

 

<mx:Canvas x="310" y="265" width="670" height="450" id="canvas_dg" horizontalScrollPolicy="off" verticalScrollPolicy="off" mouseOver="move_pause()" mouseOut="move_resume()" backgroundColor="#90C3FC">
     <mx:DataGrid x="0" y="0" width="670" height="500" id="AbfltDG" dataProvider="{fltdata}" verticalScrollPolicy="off" showHeaders="false" verticalGridLines="true" styleName="ABFlt" visible="false" backgroundColor="#90C3FC" backgroundAlpha="0.9">
    <mx:columns>
    <mx:DataGridColumn headerText="航站" dataField="stationName" textAlign="center" fontFamily="宋體" fontSize="12" itemRenderer="sim.monitor.asobj.CustomBackgroundComp"/>
    <mx:DataGridColumn headerText="航班號" dataField="fltNumber" textAlign="center" fontFamily="宋體" fontSize="12" itemRenderer="sim.monitor.asobj.CustomBackgroundComp"/>
    <mx:DataGridColumn headerText="延誤時間" dataField="delayTime" textAlign="center" fontFamily="宋體" fontSize="12" itemRenderer="sim.monitor.asobj.CustomBackgroundComp"/>
    <mx:DataGridColumn headerText="延誤原因" dataField="delayReason" textAlign="center" fontFamily="宋體" fontSize="12" itemRenderer="sim.monitor.asobj.CustomBackgroundComp"/>
    </mx:columns>
     </mx:DataGrid>
 </mx:Canvas>

 

 

      然而,為了實現在ViewStack中的定時重新整理,就要考慮一下介面效果的問題了:

      第一、如果不考慮重新整理時間,將會造成資料在滾動的過程中重新整理;

      第二、如果把滾動新聞效果頁作為一個獨立的控制項,如何在ViewStack中訪問它,並控制好每次在滾動結束時,根據重新整理策略來進行組件的重新整理;

 

      這兩個問題有些棘手,好在經過思考和查閱,想到了對策!

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.