flex项目adminConsole经验小结

一、自定义控件在主控件里的注册方法

     在主应用程序的Application标签里首先加上  xmlns:admin="admin.*" 头一个admin是相当瑜mx,后一个admin指明自定义控件的目录。(这一步是注册控件)

     添加自定义控件到desigh中写 <admin:AdminView id="adminCanvas" />  AdminView是那个自定义控件的名称。这样就把自定义控件加进去了

 

二、删除事件

    要求:删除提示,弹出一个对话框,提示删除或取消

             1、import popup.removeAlert;  removeAlert是一个自定义控件,popup是它所在的文件夹


             2、private var alertBox:removeAlert=new removeAlert();


             3、当点击删除的时候,执行这个操作
                    alertBox.type="user";
                    alertBox.text_txt="Are you sure to remove the selected item ?";
                    alertBox.adminName="bb";
                    PopUpManager.addPopUp(alertBox, DisplayObject(parentApplication), true); //屏幕居中
                    PopUpManager.centerPopUp(alertBox);

三、事件传递

    已知:alertBox是一个自定义控件,有一个属性是type

      发送:  public var type:String;

             if (type == "admin")
                {
                    dispatchEvent(new Event("removeAdmin"));
                }

        接收:在另外的一个mxml里面,alertBox监听发送过来的事件

               alertBox.addEventListener(" removeAdmin ", removeAdminAfterConfirm);

        当接收到事件后执行 removeAdminAfterConfirm()

 

四、根据textInput控件的text是否变化,并做出判断

     已知:一个textInput控件已有文字,当更改后,提示是否保存或取消

      1、 public var a1:String;


       2、   <mx:TextInput id="ashostip_txt"  change="{a1=true}"/>

        

       3、if(a1==true) {}

 

五、flex的转页面(附带参数)  比如登陆例子

    login.mxml界面  username是参数

      1、import flash.net.SharedObject;


    2、public var so:SharedObject=SharedObject.getLocal("mydata","/");

 

    3、 var user:Object=new Object();
           user.userName=name_txt.text;
            so.data.user=user;


    4、 ExternalInterface.call("function(username)   {window.location.href='IMSAdminConsole_index.swf?a1='+username}", name_txt.text);

  

   IMSAdminConsole.mxml界面

   1、import flash.net.SharedObject;


    2、public var so2:SharedObject=SharedObject.getLocal("mydata","/");

 

    3、 public var wellcomString="wellcome to adminConsole," + so2.data.user.userName;
                    


 


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值