Air Mobile andriod iOS page load control

Source: Internet
Author: User

Recently research with Flex to write Android, iOS application, encountered a page loading problem, we use the Flex SDK 12,air 15 did not find similar Android ListView paging component, so and colleagues wrote a, the effect is still possible, drag up the refresh, Drag the load down. If interested friends can take away, if you have better inform me, the code directly out of it.

<?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= "$"/&GT;&LT;/FX:DECLARATIONS&GT;&LT;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;} Drop-down load if (Event.newvalue <-3 * PADDING && event.oldvalue >=-3 * PADDING) {_hintdown.visible = True;_hint up.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 ([_hin Tdown]);} else if (Event.newvalue >=-3 * PADDING && Event.oldvalue <-3 * PADDING) {_hintdown.visible = False;_hintup . Visible = false;} Pull-Up Refresh load 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;_hintu P_up.visible = false;} else if (event.newvalue >= 6 * PADDING && Event.oldvalue < 6 * PADDING) {_hintdown_up.visible = False;_hintu p_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 {//drop-down Load method 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;//Pull-up Load method 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 <; i++) {_ac.source.push (Math.ran Dom ());} _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= "/><s:label text=" load data ... "fontsize="/></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= ""/><s:label text= "load data ..." fontsize= S:label id= "_hintdown" visible= "false" Width= "100%" paddingtop= "{PADDING}" text= "↓ dropdown refresh ↓" fontsize= "" textalign= " Center "/> <s:label id=" _hintup "visible=" false "Width=" 100% "paddingtop=" {PADDING} "text=" ↑ Let go refresh ↑ "fontsize=" 20 " textalign= "center"/><s:label id= "_hintdown_up" visible= "false" bottom= "0" width= "100%" text= "↑ Pull Refresh ↑" fontsize= "textalign=" center "/><s:label id=" _hintup_up "visible=" false "bottom=" 0 "width=" 100% "text=" ↓ Let go Refresh ↓ " Fontsize= "textalign=" "Center"/></s:application>


Air Mobile andriod iOS page load control

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.