使用flex中的httpservice方法与java进行交互(使用flex如何实现容器内元素的垂直居中对齐)一看就会

随心笔谈12个月前发布 admin
98 0

layout=”vertical”

fontSize=”12″ viewSourceURL=”srcview/index.html” xmlns:s=”library://ns.adobe.com/flex/spark”>

import mx.collections.ArrayCollection;

import mx.controls.Alert;

import mx.events.FlexEvent;

import mx.events.ItemClickEvent;

import mx.rpc.events.FaultEvent;

[Bindable]

private var myAC:ArrayCollection;

private function faultHandler(event:FaultEvent):void

{

Alert.show(event.fault.faultString, event.fault.message);

}

// Function to filter out all items with gender

private function maleFilterFunc(item:Object):Boolean {

return item.gender==1;

}

// Function to apply the filter function the ICollectionView.

private function filterMale():void {

myAC.filterFunction=maleFilterFunc;

//Refresh the collection view to apply the filter.

myAC.refresh();

}

// Function to filter out all items with gender

private function femaleFilterFunc(item:Object):Boolean {

return item.gender==0;

}

// Function to apply the filter function the ICollectionView.

private function filterFemale():void {

myAC.filterFunction=femaleFilterFunc;

//Refresh the collection view to apply the filter.

myAC.refresh();

}

// Function to Reset the view to its original state.

private function resetAC():void {

myAC.filterFunction=null;

//Refresh the collection view.

myAC.refresh();

}

// Event handler function to display the selected button

private function filterHandler(event:ItemClickEvent):void {

switch(event.currentTarget.selectedValue){

case 1:

filterMale();

break;

case 0:

filterFemale();

break;

case 2:

resetAC();

break;

default:

break;

}

}

protected function bt1_clickHandler():void

{

myService.send();

}

]]>

showBusyCursor=”true”

url=”http://localhost:8089/flex_service_HttpService/wl/HttpService01″

result=”myAC=event.result.item.student”

fault=”faultHandler(event)”

contentType=”application/xml”

/>

dataProvider=”{myAC}” >

© 版权声明

相关文章