锘??xml version="1.0" encoding="utf-8" standalone="yes"?> <?xml version="1.0" encoding="utf-8"?> internal function doResult():void <mx:Panel id="loginPanel" x="69.5" y="57" width="289" height="200" layout="absolute" title="鐧婚檰" fontSize="12">
1.寤虹珛HttpDemo.mxml錛?/p>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundGradientAlphas="[1.0, 1.0]" backgroundGradientColors="[#FD1D06, #EAF807]" height="328" width="428">
<mx:HTTPService
showBusyCursor="true"
id="loginSrv"
result="doResult();"
method="GET"
url="http://localhost/test.php">
<mx:request>
<username>
{txtname.text}
</username>
<userpassword>
{txtpwd.text}
</userpassword>
</mx:request>
</mx:HTTPService>
<mx:Script>
<![CDATA[
import mx.controls.Alert;
{
var returnValue:String=loginSrv.lastResult.Result.msg;
if(returnValue=="success")
{
this.currentState="login";
}
else
{
Alert.show("鎮ㄧ殑鐧誨綍澶辮觸浜?,"鎻愮ず淇℃伅",Alert.OK,this,null,null,Alert.YES);
}
}
]]>
</mx:Script>
<mx:states >
<mx:State id="s1" name="login">
<mx:RemoveChild target="{btnSubmit}"/>
<mx:RemoveChild target="{txtname}"/>
<mx:RemoveChild target="{txtpwd}"/>
<mx:RemoveChild target="{txtpwd}"/>
<mx:RemoveChild target="{lbname}"/>
<mx:RemoveChild target="{lbpwd}"/>
<mx:AddChild relativeTo="{loginPanel}" position="lastChild">
<mx:target>
<mx:Label text="浣犲凡緇忔垚鍔熺櫥闄嗭紒" x="64" y="33" fontSize="16" textAlign="center" fontStyle="normal" fontWeight="bold" textDecoration="normal" color="#1031AB"/>
</mx:target>
</mx:AddChild>
<mx:SetProperty target="{loginPanel}" name="title" value="鐧婚檰鎴愬姛"/>
<mx:AddChild relativeTo="{loginPanel}" position="lastChild">
<mx:Button x="95.5" y="83" label="閫鍑虹櫥闄? click="currentState=''"/>
</mx:AddChild>
</mx:State>
</mx:states>
<mx:Button x="110" y="108" label="鎻愪氦" id="btnSubmit" click="loginSrv.send();"/>
<mx:TextInput x="79" y="30" fontSize="12" id="txtname"/>
<mx:TextInput x="79" y="62" id="txtpwd"/>
<mx:Label x="21" y="32" text="濮撳悕錛? id="lbname" fontSize="12" fontWeight="bold"/>
<mx:Label x="21" y="64" text="瀵嗙爜錛? id="lbpwd" fontSize="12" fontWeight="bold"/>
</mx:Panel>
</mx:Application>
2.寤虹珛test.php錛屾斁鍒皃hp寮鍙戠殑鏍圭洰褰曚笅
<?php
$str="<Result><msg>success</msg></Result>";
echo $str;
?>
鍦╢lex builder3榪愯HttpDemo.mxml錛屽嵆鍙互鐪嬪埌鏁堟灉銆?br />
]]>
]]>
紼嶅井瑭︿簡涓涓?鍦‵lex Builder 3.0.194161,Eclipse3.4鍙?.3鐠板涓?
騫句箮鍏節鏈堝緦鍑虹殑sdk,涓嶈珫Flex3 Release鐗?Flex3 Nightly鐗?Flex4 Nightly鐗堥兘鏈冨嚭鐝鵑欐ǎ鐨勫晱欏?
鑰屼箣鍓嶇殑Flex3 Stable 3.0.3.2490鐗?Flex3 Release 3.0.0.477鐗堥兘娌掓湁鍟忛鐨?
鎵浠ユ湁鍚屾ǎ鍟忛鐨勪漢鍦╯dk bug閭勬矑鏇存柊鍓?鍙互鍏堟彌鍥炶垔鐨剆dk瑭﹁│.
Flex 3 SDK Downloads