我在这里使用Flex,并希望这样做,无论我在文本字段中有什么,都会保存并发送到我在这里的XML文件: 带有点击处理程序的http://muzika.darnus-miestas.lt/demo/index.php?r=home/GetUsers。我编写了一个HTTPService,但我很困惑的是我应该部署哪些函数来将这个文本存储在节点中。像往常一样,所有帮助都将得到极大的赞赏。 :)
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:local="*"
xmlns:index="services.index.*"
color="#0B333C" creationComplete="init();" frameRate="999" layout="absolute">
<mx:Style source="Whistle.css"/>
<!--local:whistle id="myWhistle"/-->
<mx:HBox id="controlZone" x="345" y="168" backgroundColor="#FFFFFF" enabled="false"
themeColor="#FFFFFF">
<mx:Button id="playPause" toggle="true"
upIcon="@Embed(source='../assets/media-playback-start.png')"
overIcon="@Embed(source='../assets/media-playback-start.png')"
downIcon="@Embed(source='../assets/media-playback-pause.png')"
selectedDownIcon="@Embed(source='../assets/media-playback-start.png')"
selectedUpIcon="@Embed(source='../assets/media-playback-pause.png')"
selectedOverIcon="@Embed(source='../assets/media-playback-pause.png')"
click="{if (playPause.selected) player.play(); else player.pause();}"
/>
<mx:Button id="stop" icon="@Embed(source='../assets/media-playback-stop.png')"
click="{if (playPause.selected) {player.stop();playPause.selected=false;}}"/>
<mx:HSlider id="tempo_slider" x="220" width="0" allowTrackClick="true" alpha="0.0"
change="{if (playPause.selected) player.play();}" enabled="false" maximum="240"
minimum="10" snapInterval="2"/>
</mx:HBox>
<!--<mx:Label text="midiFileURL={midiFileURL}" />-->
<mx:HTTPService id="User" url="http://muzika.darnus-miestas.lt/demo/index.php?r=home/GetUsers"
/>
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.events.FlexEvent;
import mx.events.Request;
//[Bindable]
private var midiFileURL:String;
import com.knet.Player;
private var player:Player;
private function init():void {
midiFileURL=Application.application.parameters.midiFileURL;
//midiFileURL="http://www.reveeveille.net/audio/gavotte_yves_menez_0.mid";
//midiFileURL="../assets/gavotte_yves_menez_0.mid";
//midiFileURL="../assets/bwv806b.mid";
//midiFileURL="../assets/gavotte_de_audiern.mid";
//midiFileURL="../assets/an_alarch.mid";
//midiFileURL="../assets/Another_Jig_Will_Do.mid";
midiFileURL="../assets/bro_goz.mid";
//midiFileURL="../assets/derobee_de_guingamp.mid";
//midiFileURL="../assets/Evit_Farsal_waltz.mid";
//midiFileURL="../assets/mtsofmourne.mid";
//midiFileURL="../assets/andro_traditionnel_09.mid";
player=new Player(/*myWhistle,*/tempo_slider, controlZone, midiFileURL);
}
protected function CreateNewPiece_clickHandler(event:MouseEvent):void
{
getDataResult.token = index.getData(Name.text);
}
protected function dataGrid_creationCompleteHandler(event:FlexEvent):void
{
getDataResult2.token = index.getData(/*Enter value(s) for */ r);
}
]]>
</mx:Script>
<mx:Button id="CreateNewPiece" x="24" y="21" label="Create New Piece"
click="CreateNewPiece_clickHandler(event)"/>
<mx:TextInput id="Name" x="233" y="21" text="Name"/>
<mx:CallResponder id="getDataResult"/>
<index:Index id="index"
fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)"
showBusyCursor="true"/>
<mx:DataGrid id="dataGrid" x="43" y="122" width="196" height="48"
creationComplete="dataGrid_creationCompleteHandler(event)"
dataProvider="{getDataResult2.lastResult}">
<mx:columns>
<mx:DataGridColumn dataField="userCount" headerText="userCount"/>
<mx:DataGridColumn dataField="users" headerText="users"/>
</mx:columns>
</mx:DataGrid>
<mx:CallResponder id="getDataResult2"/>
</mx:Application>