Flex中两个Application页面之间的传值

关键字: flex

情况一:在不同页面进行跳转:
传值方:
        var so:SharedObject = SharedObject.getLocal("validate","/");
        //validate是临时文件
        so.data.validateResult = true;
        so.data.number = 1;
        //1是要传得值
        so.flush();
        var request:URLRequest = new URLRequest();
        request.url = "bb.html";
        //bb.html是要跳转的页   
        navigateToURL(request); 
接受方:
          var so:SharedObject = SharedObject.getLocal("validate","/");
          var valid:Boolean = so.data.validateResult;
          if( valid != true ){
                so.clear();
          }
          else{
                var number:String = so.data.number.toString();
                  this.text.text=number;
                  so.clear();
          }
情况二:在本页面进行跳转:
传值方:
              var so:SharedObject = SharedObject.getLocal("validate","/");
              so.data.validateResult = true;
              so.data.number = 1;
            //1是要传得值   
              so.flush();
                var request:URLRequest = new URLRequest("bb.html");
                navigateToURL(request,"_self");
接受方:
          var so:SharedObject = SharedObject.getLocal("validate","/");
          var valid:Boolean = so.data.validateResult;
          if( valid != true ){
                so.clear();
          }
          else{
                var number:String = so.data.number.toString();
                  this.text.text=number;
                  so.clear();
          }

posted @ 2010-01-07 11:59  真功夫  阅读(741)  评论(0编辑  收藏  举报