FlexによるWEBメールのソースコード その5

addressWindow.mxml


<?xml version="1.0" encoding="utf-8"?>

<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml"  x="29" y="24" width="492" height="584" layout="absolute"

showCloseButton="true" close="PopUpManager.removePopUp(this);" creationComplete="initApp();" borderColor="#0000ff" backgroundColor="#bfffbf">


<mx:Script>

<![CDATA[

import mx.managers.PopUpManager;


private var nowIndex:Number = 0;


private function initApp():void

{

addressGrid_reload();

}


private function addressGrid_reload():void

{

list_get.url = "/address_list.cgi";

list_get.send();

}


private function address_get():void

{

edit_name.text = addressGrid.selectedItem.name;

edit_email.text = addressGrid.selectedItem.email;

}


private function list_get_end():void

{

addressGrid.selectedIndex = nowIndex;

edit_name.text = addressGrid.selectedItem.name;

edit_email.text = addressGrid.selectedItem.email;

}


private function new_input():void

{

nowIndex = addressGrid.selectedIndex;


address_input_complete.url = "/address_input_complete.cgi?name=" + edit_name.text + "&amp;email=" + edit_email.text;

address_input_complete.send();

}


private function edit():void

{

nowIndex = addressGrid.selectedIndex;


address_input_complete.url = "/address_input_complete.cgi?addressid=" + addressGrid.selectedItem.addressid + "&amp;name=" + edit_name.text + "&amp;email=" + edit_email.text;

address_input_complete.send();

}


private function edit_end():void

{

addressGrid_reload();

}


private function del():void

{

nowIndex = addressGrid.selectedIndex;


address_del.url = "/address_del.cgi?addressid=" + addressGrid.selectedItem.addressid;

address_del.send();

}


private function del_end():void

{

addressGrid_reload();

}


private function clear():void

{

edit_name.text = "";

edit_email.text = "";

}


private function push_address():void

{

var msg:String = "";

if( addressGrid.selectedItem.name != "" )

{

msg = addressGrid.selectedItem.name + "<" + addressGrid.selectedItem.email + ">";

}

else

{

msg = addressGrid.selectedItem.email;

}


var eventOBJ:MyEvent = new MyEvent( MyEvent.CHILD_CLOSE,msg );

dispatchEvent( eventOBJ );


PopUpManager.removePopUp( this );


}

]]>

</mx:Script>


<mx:HTTPService id="list_get"

url="/address_list.cgi"

result="list_get_end()" useProxy="false" />


<mx:HTTPService id="address_input_complete"

url="/address_input_complete.cgi"

result="edit_end()" useProxy="false" />


<mx:HTTPService id="address_del"

url="/address_del.cgi"

result="del_end()" useProxy="false" />


<mx:DataGrid id="addressGrid"

dataProvider="{list_get.lastResult.rss.channel.item}"

click="address_get()"

doubleClick="push_address()" doubleClickEnabled="true"

x="10" y="39" width="457.5" height="329" fontSize="14" color="#000000" fontWeight="bold">

<mx:columns>

<mx:DataGridColumn headerText="名前" dataField="name"/>

<mx:DataGridColumn headerText="Eメール" dataField="email"/>

</mx:columns>

</mx:DataGrid>

<mx:Label x="10" y="378" text="名前" fontSize="14" color="#000000"/>

<mx:TextInput id="edit_name" x="60" y="376" fontSize="14" color="#000000"/>

<mx:Label x="10" y="412" text="Eメール" fontSize="14" color="#000000"/>

<mx:TextInput id="edit_email" x="60" y="410" fontSize="14" color="#000000"/>

<mx:Button x="84" y="443" label="新規作成" click="new_input()"  fontSize="14" color="#000000"/>

<mx:Button x="186" y="444" label="編集登録" click="edit()"  fontSize="14" color="#000000"/>

<mx:Button x="280" y="445" label="削除" click="del()"  fontSize="14" color="#000000"/>

<mx:Button x="10" y="472" label="メール作成" fontSize="14" color="#000000"/>

<mx:Button x="10" y="442" label="クリア" click="clear()"  fontSize="14" color="#000000"/>

<mx:Button x="10" y="9" label="閉じる" fontSize="14" color="#000000" click="PopUpManager.removePopUp(this);" />


</mx:TitleWindow>





コメントをどうぞ