Flex实现在ViewStack中的滚动新闻实时刷新(上)!

      先描述一下作品的需求:

      滚动新闻作为当前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中访问它,并控制好每次在滚动结束时,根据刷新策略来进行组件的刷新;

 

      这两个问题有些棘手,好在经过思考和查阅,想到了对策!

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值