http://bbs.cpapri.com/showtopic-43.aspx
Flex中两个Application页面之间的传值~
通常,我们在做页面传值的时候,都是用TitleWindow弹出框进行传值,下面我给大家介绍一下,两个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();
}
情况一:在不同页面进行跳转:
传值方:
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();
}