ArrayCollection get maximum value and get minimum value

Source: Internet
Author: User

ArrayCollection get maximum value and get minimum value

<?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"xmlns:mx="LIBRARY://NS.ADOBE.COM/FLEX/MX"Minwidth="955"minheight=" the"> <fx:Declarations> <!--Place non-visual elements (such as services, value objects) here--</Fx:declarations> <fx:Script> <![cdata[Importmx.collections.ArrayCollection; ImportMx.collections.Sort; ImportMx.collections.SortField; ImportMx.controls.Alert; [Bindable]             Public varColl:arraycollection =Newarraycollection ([{getinfotime:' 2013-04-23 10:00am ', Waterheight:6}, {getinfotime:' 2013-04-23 10:02 ', Waterheight:2}, {getinfotime:' 2013-04-23 10:04 ', Waterheight:3}, {getinfotime:' 2013-04-23 10:06 ', waterheight:1000}, {getinfotime:' 2013-04-23 10:08 ', waterheight:5.0}, {getinfotime:' 2013-04-23 10:10 ', waterheight:2000}            ]); //Get A function of the maximum             Public functionBtn_getmaxvalue_clickhandler ():void{                varSort:sort =NewSort (); //Sort by Waterheight ascendingsort.fields=[NewSortField ("Waterheight")]; Coll.sort=sort;                Coll.refresh (); Alert.show (Coll[coll.length-1].waterheight); }                        //Get A function of the minimum             Public functionBtn_getminvalue_clickhandler ():void{                varSort:sort =NewSort (); //Sort by Waterheight ascendingsort.fields=[NewSortField ("Waterheight")]; Coll.sort=sort;                Coll.refresh (); Alert.show (coll[0].waterheight); }        ]]> </Fx:script> <s:button x="171"y="156"Width=" the"height="to"Label="Get maximum Value"click="Btn_getmaxvalue_clickhandler ();" /> <s:button x="321"y="157"Width=" the"height="to"Label="Get minimum Value"click="Btn_getminvalue_clickhandler ();" /> </S:application>

ArrayCollection get maximum value and get minimum value

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.