air mobile andriod ios 页面加载控件
ios 页面 加载 控件 mobile Air Andriod
2023-09-27 14:27:02 时间
通过最近的研究flex 书写android 、ios申请书,我们遇到了一个问题加载页面,我们用flex sdk 12,air 15 无级似android ListView寻呼模块。所以,我和我的同事们写了一,效果依然能够,拖动刷新,向下拖动负载。走,假设你有更好的通知我一声,代码就直接帖出来吧。
<?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" applicationComplete="init()"> <fx:Declarations> <s:ArrayCollection id="_ac"/> <s:Fade id="_fadeIn" alphaFrom="0" alphaTo="1" duration="500"/> </fx:Declarations> <fx:Script> <![CDATA[ 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 != 'verticalScrollPosition') { return; } //下拉 载入 if (event.newValue < -3 * PADDING && event.oldValue >= -3 * PADDING) { _hintDown.visible = true; _hintUp.visible = false; _fadeIn.play([_hintDown]); } else if (event.newValue < -6 * PADDING && event.oldValue >= -6 * PADDING) { _hintDown.visible = false; _hintUp.visible = true; _fadeIn.play([_hintUp]); } else if (event.newValue >= -6 * PADDING && event.oldValue < -6 * PADDING) { _hintDown.visible = true; _hintUp.visible = false; _fadeIn.play([_hintDown]); } else if (event.newValue >= -3 * PADDING && event.oldValue < -3 * PADDING) { _hintDown.visible = false; _hintUp.visible = false; } //上拉刷新 载入 if (event.newValue < 3 * PADDING && event.oldValue >= 3 * PADDING) { _hintDown_up.visible = false; _hintUp_up.visible = false; } else if (event.newValue < 6 * PADDING && event.oldValue >= 6 * PADDING) { _hintDown_up.visible = false; _hintUp_up.visible = false; } else if (event.newValue >= 6 * PADDING && event.oldValue < 6 * PADDING) { _hintDown_up.visible = false; _hintUp_up.visible = true; _fadeIn.play([_hintUp_up]); } else if (event.newValue >= 3 * PADDING && 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; } ]]> </fx:Script> <s:VGroup width="100%" > <s:HGroup id="_busy" visible="false" width="100%" horizontalAlign="center" includeInLayout="false" verticalAlign="middle"> <s:BusyIndicator height="30"/> <s:Label text="载入数据..." fontSize="20"/> </s:HGroup> <s:List id="_list" width="100%" contentBackgroundColor="#FFFFFF" dataProvider="{_ac}" mouseUp="startLoading(event)"/> <s:HGroup id="_busy_x" visible="false" width="100%" horizontalAlign="center" includeInLayout="false" verticalAlign="middle"> <s:BusyIndicator height="30"/> <s:Label text="载入数据..." fontSize="20"/> </s:HGroup> </s:VGroup> <s:Label id="_hintDown" visible="false" width="100%" paddingTop="{PADDING}" text="↓ 下拉刷新 ↓" fontSize="20" textAlign="center"/> <s:Label id="_hintUp" visible="false" width="100%" paddingTop="{PADDING}" text="↑ 松手刷新 ↑" fontSize="20" textAlign="center"/> <s:Label id="_hintDown_up" visible="false" bottom="0" width="100%" text="↑ 上拉刷新 ↑" fontSize="20" textAlign="center"/> <s:Label id="_hintUp_up" visible="false" bottom="0" width="100%" text="↓ 松手刷新 ↓" fontSize="20" textAlign="center"/> </s:Application>
版权声明:本文博主原创文章。博客,未经同意不得转载。
相关文章
- 微信小程序 - 完美解决 web-view 公众号文章或第三方网站分享转发后,打开提示 “无法打开该页面,不支持打开” 或 “页面不存在”(IOS 苹果系统打开是空白页,安卓系统会有提示)超详细排查
- 【数据】开发iOS应用,不得不看的数据和教训
- iOS 9应用开发教程之使用代码添加按钮美化按钮
- 《iOS 6核心开发手册(第4版)》——1.13节秘诀:从滚动视图中拖动
- 《iOS 6核心开发手册(第4版)》——2.15节添加页面指示控件
- iOS获取屏幕亮度及设置
- mac下cordova的ios-deploy安装问题
- IOS atomic与nonatomic,assign,copy与retain的定义和区别
- iOS - 设置导航栏之标题栏居中、标题栏的背景颜色
- iOS开发中的这些权限,你搞懂了吗?
- iOS页面间传值的方式(Delegate/NSNotification/Block/NSUserDefault/单例)
- 3DTouch - iOS新特性
- iOS游戏开发之使用 Spritekit 框架和 Swift 的 iOS 2D 太空射击游戏(教程含源码)
- Flutter 高级教程之如何开发iOS Widget小组件展示SQLite本地数据库数据(教程含完整源码)
- SwiftUI iOS 组件之HTML页面解析组件(教程含源码)
- iOS页面间传值的方式(Delegate/NSNotification/Block/NSUserDefault/单例)
- 《黑客大曝光:移动应用安全揭秘及防护措施》一3.2 iOS到底有多安全
- uni-app知识点:禁止页面返回及如何实现自定义返回逻辑、实现再次返回退出应用时不退出应用而是在后台运行、uni-app ios滑动时卡顿不流畅问题解决方案
- iOS 注册或登录页面(UILable,UITextField,UIButton)
- iOS - 直播相关文章