Air mobile andriod ios paging Control

Source: Internet
Author: User

Air mobile andriod ios paging Control

Recently, I have studied how to use flex to write android and ios apps. I encountered a paging loading problem. We used flex sdk 12 and air 15 didn't find a paging component similar to android ListView, so I wrote it with my colleagues, and the effect is still acceptable. Drag and refresh up, drag and load down. If you are interested, you can take it away. If you have better notifications, post the Code directly.

 
 
  
   
   
  
  import mx.events.PropertyChangeEvent;private static const PADDING:uint = 15;private function init():void {updateList();_list.dataGroup.addEventListener(PropertyChangeEvent.PROPERTY_CHANGE, handleScroll);}private function handleScroll(event:PropertyChangeEvent):void {if (_busy.visible || _busy_x.visible || event.source != event.target || event.property != &#39;verticalScrollPosition&#39;) {return;}//下拉 加载 if (event.newValue < -3 * PADDING &amp;&amp; event.oldValue >= -3 * PADDING) {_hintDown.visible = true;_hintUp.visible = false;_fadeIn.play([_hintDown]);} else if (event.newValue < -6 * PADDING &amp;&amp; event.oldValue >= -6 * PADDING) {_hintDown.visible = false;_hintUp.visible = true;_fadeIn.play([_hintUp]);} else if (event.newValue >= -6 * PADDING &amp;&amp; event.oldValue < -6 * PADDING) {_hintDown.visible = true;_hintUp.visible = false;_fadeIn.play([_hintDown]);} else if (event.newValue >= -3 * PADDING &amp;&amp; event.oldValue < -3 * PADDING) {_hintDown.visible = false;_hintUp.visible = false;}//上拉刷新 加载 if (event.newValue < 3 * PADDING &amp;&amp; event.oldValue >= 3 * PADDING) {_hintDown_up.visible = false;_hintUp_up.visible = false;} else if (event.newValue < 6 * PADDING &amp;&amp; event.oldValue >= 6 * PADDING) {_hintDown_up.visible = false;_hintUp_up.visible = false;}else if (event.newValue >= 6 * PADDING &amp;&amp; event.oldValue < 6 * PADDING) {_hintDown_up.visible = false;_hintUp_up.visible = true;_fadeIn.play([_hintUp_up]);}else if (event.newValue >= 3 * PADDING &amp;&amp; event.oldValue < 3 * PADDING) {_hintDown_up.visible = true;_hintUp_up.visible = false;_fadeIn.play([_hintDown_up]);}}private function startLoading(event:MouseEvent):void {//下拉 加载方法if (_hintUp.visible) {_busy.includeInLayout = _busy.visible = true;if(_hintDown.visible)_busy_x.includeInLayout = _busy_x.visible = true;setTimeout(updateList, 1000);}_hintDown.visible = false;_hintUp.visible = false;//上拉 加载方法if (_hintUp_up.visible) {_busy_x.includeInLayout = _busy_x.visible = true;if(_hintDown_up.visible)_busy_x.includeInLayout = _busy_x.visible = true;setTimeout(updateList, 1000);}_hintDown_up.visible = false;_hintUp_up.visible = false;}private function updateList():void {_ac.source = new Array();for (var i:int = 0; i < 10; i++) {_ac.source.push(Math.random());}_ac.refresh();_busy.includeInLayout = _busy.visible = false;_busy_x.includeInLayout = _busy_x.visible = false;}
  
  
   
    
    
   
   
   
    
    
   
  
   
  
  
  
 


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.