The first is the event source, that is, where it starts. The following is an input box:
<Mx: formitem label = "group Customer:" width = "42%"> <br/> <! -- Change1 --> <br/> <mx: textinput id = "txtassociation" width = "235" maxchars = "32" change = "associate (); "/> <br/> </MX: formitem>
Then there is the processing effect. These contents are all obtained from the database and dynamically identified.
Import MX. collections. arraycollection; <br/> Import MX. events. flexmouseevent; <br/> Import MX. events. listevent; <br/> Import MX. managers. popupmanager; </P> <p> Import resources.com. list. association; </P> <p> // rendered Lenovo result list <br/> private var list: Association; <br/> // temporary string, used to determine whether the value of the Lenovo box changes when a keyup event occurs. If the value is not changed, it is not associated. <br/> private var temp: String = ''; <br/> private function changeassociation (): void {<br/> temp = ''; <br /> Txtassociation. Text = ''; <br/> associationresult = NULL; <br/> If (list! = NULL) {<br/> popupmanager. removepopup (list); <br/> List = NULL; <br/> // clear the temporary string <br/>}< br/> private function associate (): void {<br/> var STR: string = txtassociation. text; <br/> If (Str. length <2) {<br/> associationresult = NULL; <br/>}< br/> If (STR! = Temp) {<br/> If (Str. Length <2) {<br/> If (list! = NULL) {<br/> popupmanager. removepopup (list); <br/> List = NULL; <br/> // clear the temporary string <br/> temp = ''; <br/>}< br/> return; <br/>}< br/> temp = STR; </P> <p> var Params: Object = {}; <br/> Params ['areano '] = cbxarea. selecteditem. data; <br/> Params ['nettype'] = cbxnettype. selecteditem. data; <br/> Params ['str'] = STR; <br/> Params ['handle'] = 'associate'; <br/> service4association. send (Params); <br/>}< br/> Private function openassociation (): void {<br/> If (service4association. lastresult. Items! = NULL) <br/> createandshow (service4association. lastresult. Items. item); </P> <p> else if (list! = NULL) {<br/> popupmanager. removepopup (list); <br/> List = NULL; <br/> // clear the temporary string <br/> temp = ''; <br/>}< br/> private function createandshow (DP: Object): void {<br/> // each time before the Lenovo box is opened, clear cache first <br/> If (list! = NULL) {<br/> // remove the Lenovo box from popupmanager <br/> popupmanager. removepopup (list); <br/> // clear the Lenovo box instance <br/> List = NULL; <br/>}</P> <p> List = new Association (); <br/> // specify the data source <br/> list. dataprovider = DP; <br/> // obtain the mouse coordinate and assign it to list <br/> list. X = txtassociation. X + 219; <br/> list. y = txtassociation. Y + 205; <br/> // size <br/> list. minwidth = 400; <br/> list. maxheight = 270; <br/> // register the list by pressing the mouse and clicking the Project event <br/> list. addeventlistener (flexmouseevent. mouse_down_outside, mousedownoutsidehandler); <br/> list. addeventlistener (listevent. item_click, itemclik); </P> <p> // The list is displayed. <br/> popupmanager. addpopup (list, this, false); <br/>}< br/> private var associationresult: object; <br/> private function itemclik (Event: listevent ): void {<br/> associationresult = arraycollection(association(event.tar get ). dataprovider ). getitemat (event. rowindex); <br/> txtassociation. TEXT = associationresult. label; <br/> // alert. show (associationresult. data); <br/> removepopupidisplay(association(event.tar get); <br/>}< br/> private function mousedownoutsidehandler (Event: mouseevent ): void {<br/> removepopupidisplay(association(event.tar get); <br/>}< br/> private function removepopupidisplay (OBJ: Association ): void {<br/> // clear the temporary string <br/> temp = ''; <br/> obj. removeeventlistener (flexmouseevent. mouse_down_outside, mousedownoutsidehandler); <br/> popupmanager. removepopup (OBJ); <br/>}< br/>/** -------------------------- Lenovo -------------------------------**/
There is another class, which is also posted here. The sharing principle is completely achievable.
<? XML version = "1.0" encoding = "UTF-8"?> <Br/> <mx: List xmlns: MX = "http://www.adobe.com/2006/mxml" initialize = "initapp ();" xmlns: filters = "flash. filters. * "<br/> alternatingitemcolors =" [# eeeeee, white] "buttonmode =" true "> </P> <p> <mx: SCRIPT> <br/> <! -- [CDATA [<br/> private function initapp (): void {<br/> showeffect. play (); <br/>}< br/>] --> <br/> </MX: SCRIPT> </P> <p> <mx: itemrenderer> <br/> <mx: component> <br/> <mx: hbox horizontalgap = "0" paddingleft = "5"> <br/> <mx: image Source = "@ embed ('resources/icons/building.png ')"/> <br/> <mx: Text text = "{data. prefix} "paddingleft =" 5 "/> <br/> <mx: Text text =" {data. STR} "color =" green "/> <br/> <mx: Text text =" {data. suffix} "/> <br/> </MX: hbox> <br/> </MX: component> <br/> </MX: itemrenderer> </P> <p> <mx: Parallel id = "showeffect" target = "{This}" Duration = "300"> <br/> <mx: fade/> <br/> <mx: wipedown/> <br/> </MX: Parallel> </P> <p> </MX: List>
Flex-similar to Google Lenovo box effects-this effect has been used in many places now. Of course, Google is offline now, so it won't be used. But as I said on the internet, I 'd like to find a solution, it can still come out. haha, but there is no need for us. in Flex, the query results can be better achieved. so we also need to make such a dynamic query.