以后不在此处更新日志了,欢迎测友到新窝找我:http://www.wuchuanhu.cn/

Flex学习第一步

上一篇 / 下一篇  2011-05-03 18:58:02 / 个人分类:FLEX学习

为了后期做Flex相关应用的测试,计划开始学习一些简单的Flex开发知识。今天花了一点时间写了一个小页面,算是迈出的第一步吧。等这个应用写完之后,再在自己写的应用的基础上写一些关于flex自动化测试和单元测试的东东。废话不多说,先上图。

这个应用由三部分组成:FLEX前端、.NET写的接口、数据库。功能嘛,可以从图中看出来。

下面是代码的片段(代码写的很乱,没有开发经验的下场),提交任务后,“提交任务”按钮会变灰色,用户在点击“刷新按钮”之后“提交任务”按钮可用。点击“查看任务”会进入一个查询页面(还没写)。因为.NET接口和数据库还在完善,暂时就不出代码了,写完成后,会把所有的代码发出来供拍砖。

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" height="625">
<mx:WebService id="projectplan" wsdl="http://localhost:3895/Service1.asmx?wsdl" result="onResult(event)" fault="onFault(event)" useProxy="false">
<mx:operation name="addprojectplan">
</mx:operation>
</mx:WebService>
<mx:Script>
 <![CDATA[
  import mx.rpc.soap.mxml.Operation;
  import mx.collections.ArrayCollection;
  import mx.rpc.events.FaultEvent;
  import mx.rpc.events.ResultEvent;
  import mx.controls.Alert;
  import flash.net.navigateToURL;
  
  [Bindable]
  private var buttonstatus:Boolean=true;
  
  private function onResult(event:ResultEvent):void  
  {
   /*Alert.show(event.result.Issuccess);*/
   
   if(event.result.Issuccess==true)
   {
    Alert.show("任务添加成功,点击确定继续添加!")
   }
   else
   {
   Alert.show("任务添加失败,点击确定重新添加!");
   }
  }
  private function onFault(event:FaultEvent):void  
  {
   Alert.show("页面出现异常,请稍后再试!");/*+event.fault.faultDetail.toString()*/
  }
  public function addplan():void
  {
   buttonstatus=false;
   var addrequest:Object=new Object();
   addrequest.project=projectchoice.label;
   addrequest.chaneltype=channeltypelabel.label;
   addrequest.tasktype=tasktypelabel.label;
   addrequest.requiretype=requiretypelabel.label;
   addrequest.status=statuslabel.label;
   addrequest.City=cityname.text;
   addrequest.requirement=Requirment.text;
   addrequest.first=firstlabel.label;
   addrequest.requireCloseTime=requireCloseTime.selectedDate;
   addrequest.dvtime=dvtime.selectedDate;
   addrequest.deploytime=deploytime.selectedDate;
   addrequest.rm=RMname.text;
   addrequest.dev=developername.text;
   addrequest.tester=testername.text;
   projectplan.addprojectplan(addrequest);
  }
  public function freshbutton():void
  {
   buttonstatus=true;
  }
  public function turntootherpage():void
  {
   navigateToURL(new URLRequest("content.html"),"_self");
  }
 ]]>
</mx:Script>
 
    <mx:XMLList id="treeDP2">
        <node label="本周新增"/>
        <node label="上周遗留"/>
        <node label="跨周需求"/>
        <node label="项目建设"/>
    </mx:XMLList>
    <mx:XMLList id="treeDP1">
        <node label="Web"/>
        <node label="Ivr"/>
        <node label="Sms"/>
        <node label="Other"/>
    </mx:XMLList>
    <mx:XMLList id="treeDP0">
        <node label="Usp"/>
        <node label="Mc"/>
        <node label="Best"/>
        <node label="Other"/>
    </mx:XMLList>
    <mx:XMLList id="treeDP3">
        <node label="开发"/>
        <node label="测试"/>
        <node label="Other"/>
    </mx:XMLList>
    <mx:XMLList id="treeDP4">
        <node label="A"/>
        <node label="B"/>
        <node label="C"/>
    </mx:XMLList>
    <mx:XMLList id="treeDP5">
        <node label="未开始"/>
        <node label="进行中"/>
        <node label="已结束"/>
        <node label="暂停中"/>
        <node label="已取消"/>
    </mx:XMLList>
 <mx:Panel y="0" width="726" height="524" layout="absolute" title="添加项目组计划" horizontalAlign="center" verticalAlign="middle" borderColor="#ED0E0E" color="#D0D0CE" fontSize="13" fontFamily="Arial" themeColor="#2E97D9" horizontalCenter="-16">
  <mx:Label x="21" y="210" text="需求描述" width="90" fontSize="12" color="#070707" fontFamily="Arial" id="RequirmentDS" fontWeight="bold"/>
  <mx:Label x="21" y="164" text="需求分类" width="90" id="requiretype" fontFamily="Arial" fontSize="12" color="#070707" fontWeight="bold"/>
  <mx:PopUpMenuButton  x="119" y="163" id="requiretypelabel" dataProvider="{treeDP2}" labelField="@label" color="#070707" fontWeight="normal"/>
  <mx:TextArea x="119" y="210" id="Requirment" color="#070707" width="550" text="此处请详细填写需求描述"/>
  <mx:Label x="21" y="73" text="渠道类型" width="90" id="channeltype" fontFamily="Arial" fontSize="12" color="#070707" fontWeight="bold"/>
  <mx:PopUpMenuButton x="119" y="72" id="channeltypelabel" dataProvider="{treeDP1}" labelField="@label" color="#070707" fontWeight="normal"/>
  <mx:Label x="21" y="28" text="项目名称" width="90" id="project" fontFamily="Arial" fontSize="12" color="#070707" fontWeight="bold"/>
  <mx:PopUpMenuButton x="119" y="27" id="projectchoice" dataProvider="{treeDP0}" labelField="@label" color="#070707" fontWeight="normal"/>
  <mx:Label x="236" y="117" text="地市名称" width="90" id="City" fontFamily="Arial" fontSize="12" color="#070707" fontWeight="bold"/>
  <mx:TextInput x="334" y="114" width="78" id="cityname" height="24" color="#070707"/>
  <mx:Label x="21" y="117" text="任务类型" width="90" id="tasktype" fontFamily="Arial" fontSize="12" color="#070707" fontWeight="bold"/>
  <mx:PopUpMenuButton x="119" y="116" id="tasktypelabel" dataProvider="{treeDP3}" labelField="@label" color="#070707" fontWeight="normal"/>
  <mx:Label x="236" y="28" text="优先级" width="90" id="first" fontFamily="Arial" fontSize="12" color="#070707" fontWeight="bold"/>
  <mx:PopUpMenuButton x="334" y="27" id="firstlabel" dataProvider="{treeDP4}" labelField="@label" color="#070707" fontWeight="normal"/>
  <mx:Label x="236" y="73" text="当前状态" width="90" id="status" fontFamily="Arial" fontSize="12" color="#070707" fontWeight="bold"/>
  <mx:PopUpMenuButton x="334" y="72" id="statuslabel" dataProvider="{treeDP5}" labelField="@label" color="#070707" fontWeight="normal"/>
  <mx:Label x="236" y="282" text="责任产品经理" width="90" id="RM" fontFamily="Arial" fontSize="12" color="#070707" fontWeight="bold"/>
  <mx:TextInput x="334" y="279" width="335" id="RMname" height="24" color="#070707" text="如果有多个,请用“,”分隔开"/>
  <mx:Label x="446" y="28" text="外部协助及资源:" width="134" id="City0" fontFamily="Arial" fontSize="12" color="#070707" fontWeight="bold"/>
  <mx:TextArea x="446" y="50" width="223" height="126" text="此处输入需要产品或开发提供的文档或其他材料;或者填写其他需要协调的资源" id="OtherHelp" color="#070707"/>
  <mx:Label x="21" y="279" text="需求完成时间" width="90" fontSize="12" color="#070707" fontFamily="Arial" id="CloseTime" fontWeight="bold"/>
  <mx:DateField x="119" y="279" color="#070707" formatString="YYYY-MM-DD" id="requireCloseTime"/>
  <mx:Label x="21" y="328" text="版本提交时间" width="90" fontSize="12" color="#070707" fontFamily="Arial" id="CloseTime0" fontWeight="bold"/>
  <mx:DateField x="119" y="325" color="#070707" formatString="YYYY-MM-DD" id="dvtime"/>
  <mx:Label x="236" y="328" text="责任开发人员" width="90" id="developer" fontFamily="Arial" fontSize="12" color="#070707" fontWeight="bold"/>
  <mx:TextInput x="334" y="325" width="335" id="developername" height="24" color="#070707" text="如果有多个,请用“,”分隔开"/>
  <mx:Label x="21" y="380" text="提交部署时间" width="90" fontSize="12" color="#070707" fontFamily="Arial" id="deploy" fontWeight="bold"/>
  <mx:DateField x="119" y="377" color="#070707" formatString="YYYY-MM-DD" id="deploytime"/>
  <mx:Label x="236" y="380" text="责任测试人员" width="90" id="tester" fontFamily="Arial" fontSize="12" color="#070707" fontWeight="bold"/>
  <mx:TextInput x="334" y="377" width="335" id="testername" height="24" color="#070707" text="如果有多个,请用“,”分隔开"/>
  <mx:Button x="119" y="435" label="提交任务" color="#070707" fillAlphas="[1.0, 1.0]" fillColors="[#CE7474, #CE7474]" id="addtask" click="addplan()" enabled="{buttonstatus}"/>
  <mx:Button x="330" y="435" label="刷新按钮" color="#070707" fillAlphas="[1.0, 1.0]" fillColors="[#CE7474, #CE7474]" id="fresh" click="freshbutton()"/>
  <mx:Button x="587" y="435" label="查看任务" color="#070707" fillAlphas="[1.0, 1.0]" fillColors="[#CE7474, #CE7474]" id="content" click="turntootherpage()"/>
 </mx:Panel>
 
</mx:Application>


TAG: flex Flex FLEX

 

评分:0

我来说两句

Open Toolbar