1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
| <?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute" horizontalAlign="left"
initialize="addcheck()">
<s:HTTPService id="srv4" result="test()" resultFormat="e4x"/>
<mx:Script>
<![CDATA[
import mx.controls.CheckBox;
import mx.collections.ArrayCollection;
var myCheck:CheckBox;
public function addcheck():void
{
myHbox.removeAllChildren();
for (var i:int=1; i<4; i++)
{
var myCheck:CheckBox = new CheckBox;
myCheck.label = ("algo" + String(i));
myCheck.id = String(i);
myCheck.addEventListener(MouseEvent.CLICK,check);
myHbox.addChild(myCheck);
}
}
public function check(e:Event):void
{
if (e.currentTarget.selected == true)
{
mydg1.dataProvider.removeAll();
PB.visible = true;
var algo:String = e.currentTarget.id;
srv4.url = String("http://*****/yam/match?action=match&schema=biology&algo=algo"+algo);
srv4.send();
}
}
private var myArr:ArrayCollection = new ArrayCollection();
public function test():void
{
PB.visible = false;
var testdg:Boolean = true;
var test1:String = String(srv4.lastResult);
var myPattern:RegExp = / = /g;
var usd = test1.replace(myPattern, ";");
var re:RegExp = /\n|;/;
var result1:Array = usd.split(re);
for(var i:int=0; i<result1.length; i++)
{
if (testdg == true)
{var newObj:Object = {} ;
newObj["test"] = result1[i];
testdg =false;
}
else
{
newObj["test2"] = result1[i];
testdg =true;
myArr.addItem(newObj);
}
}
}
]]>
</mx:Script>
<mx:HBox id="myHbox" x="128" y="34" width="382"/>
<mx:DataGrid x="115" y="122" dataProvider="{myArr}" id="mydg1" width="460" height="167">
<mx:columns>
<mx:DataGridColumn headerText="Label1" dataField="test" />
<mx:DataGridColumn headerText="Label2" dataField="test2" />
</mx:columns>
</mx:DataGrid>
<mx:ProgressBar x="329" y="218" label="Chargement" visible="false" labelPlacement="center" id="PB"/>
</mx:Application> |
Partager