Air mobile andriod ios paging control, andriodios
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.
<? 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. specified roup. addEventListener (PropertyChangeEvent. PROPERTY_CHANGE, handleScroll);} private function handleScroll (event: PropertyChangeEvent): void {if (_ busy. visible | _ busy_x.visible | event. source! = Event.tar get | event. property! = 'Verticalscrollposition') {return;} // load 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;} // pull up to refresh and 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; _ 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 {// method of pulling down the load 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; // The method of uploading. if (_ hintUp_up.visible) {_ identifier = _ busy_x.visible = true; if (_ hintDown_up.visible) _ busy_x.includeInLayout = _ busy_x.visible =; 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 = "load data... "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 = "load data... "fontSize =" 20 "/> </s: HGroup> </s: VGroup> <s: label id = "_ hintDown" visible = "false" width = "100%" paddingTop = "{PADDING}" text = "resize pull-down refresh history" 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 = "pull up refresh Pipeline" fontSize = "20" textAlign = "center "/> <s: label id = "_ hintUp_up" visible = "false" bottom = "0" width = "100%" text = "fresh worker" fontSize = "20" textAlign = "center" /> </s: application>