Flex processing server-side data 1th/2 page _flex

Source: Internet
Author: User
Let me give a more comprehensive example, first look at the structure of the entire project, server-side use of blazeds, the structure of

The client uses Flex Builder 3 development and the structure follows the Flex Builder 3 standard

Client.mxml for

Copy Code code as follows:

<?xml version= "1.0" encoding= "Utf-8"?>
<mx:application xmlns:mx= "Http://www.adobe.com/2006/mxml"
layout= "Vertical" >
<mx:remoteobject destination= "HelloService"
Id= "Test1" >
<mx:method name= "Hello"
result= "Sayhelloresult (event)"/>
<mx:method name= "World"
result= "Sayworldresult (event)"/>
<mx:method name= "Getmap"
result= "Getmapresult (event)"/>
<mx:method name= "GetList"
result= "Getlistresult (event)"/>
<mx:method name= "Getset"
result= "Getsetresult (event)"/>
</mx:RemoteObject>
<mx:HBox>
<mx:label text= "Input:"/>
<mx:textinput id= "Inputstr"/>
<mx:button label= "Say hello"
click= "SayHello (event);" />
<mx:button label= "Say World"
click= "Sayworld (event);" />
<mx:button label= "Get Map"
Click= "Test1.getmap ()"/>
<mx:button label= "Get List"
Click= "test1.getlist ()"/>
<mx:button label= "Get Set"
Click= "Test1.getset ()"/>
</mx:HBox>
<mx:HBox>
<mx:label text= "Result:"/>
<mx:textarea id= "Result"/>
</mx:HBox>

<mx:Script>

<!--[cdata[
Import mx.collections.ArrayCollection;
Import mx.rpc.events.FaultEvent;
Import Mx.controls.Alert;
Import mx.rpc.events.ResultEvent;
Import CN. person;
[bindable]
public Var Person:person;
[bindable]

public Var map:arraycollection=null;

function SayHello (event:event): void
{
var Inputvar:string=inputstr.text;
Test1.hello (Inputvar);

}

function Sayworld (event:event): void
{
var Inputvar:string=inputstr.text;
Test1.world (Inputvar);

}

Private Function Sayhelloresult (event:resultevent): void
{
Result.text=event.result.tostring ();
Alert.show (Event.result.toString (), "return result");
}

Private Function Sayworldresult (event:resultevent): void
{
Result.text=event.result.tostring ();
Alert.show (Event.result.toString (), "return result");
}

Private Function Getmapresult (event:resultevent): void
{
for (Var key:string in Event.result)
{
var list:arraycollection=event.result[key] as ArrayCollection;
for (var key1:object in list)
{
Alert.show ("Map Item key is:" + key + "value is:" + key1);
}

}
}

Private Function GetList (): void
{
Test1.getlist ();
}

Private Function Getlistresult (event:resultevent): void
{
var ac:arraycollection=event.result as ArrayCollection;
for (Var i:int=0 i < ac.length; i++)
{
var P1:person=ac.getitemat (i) as person;
Alert.show ("list item name is:" + p1.name+ "\ n Another usage:" +ac.getitemat (i). Name);
}

}
Private Function Getset (): void
{
Test1.getset ();
}

Private Function Getsetresult (event:resultevent): void
{
var ac:arraycollection=event.result as ArrayCollection;
for (Var i:int=0 i < ac.length; i++)
{
var P1:person=ac.getitemat (i) as person;
Alert.show ("Set Item name is:" + p1.name);
}

}
]]-->
</mx:Script>
</mx:Application>

Current 1/2 page 12 Next read the full text

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.