flex中navigateToURL发送多个参数

1,
  var ssk:Array=["fgd","fsff","fsfsf","gdgd"];
  navigateToURL(new URLRequest("hdsfsfs.html?para1="+ssk), "quote"); 

2,
  function getparafromurl() {
    var url,pos,parastr,para;
    url = window.location.href;
    pos = url.indexOf("?")
    parastr = url.substring(pos+1);
    return parastr;
}或者
function hje()
{
var url = window.location.href;
var pos = url.indexOf("?");
if(pos!=-1)
{
   var params = url.substr(pos+1);
}
return params
}或者

function   getvalue(name)
{
  var   str=window.location.search;
  if   (str.indexOf(name)!=-1)
  {
    var   pos_start=str.indexOf(name)+name.length+1;
    var   pos_end=str.indexOf( "&",pos_start);
    if   (pos_end==-1)
    {
      return   str.substring(pos_start);
    }
    else
    {
      return   str.substring(pos_start,pos_end)
    }
  }
  else
  {
//     return   "没有这个name值 ";
  }


3,
"FlashVars", "para1="+getvalue("para1"),
4,
var msg:String = mx.core.Application.application.parameters.para1;
Alert.show(msg);
var msg_arr:Array=msg.split(","); 
var ss:String=msg_arr[2];
Alert.show(ss);




2:实例
发送页(test.mxml):
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">

    <mx:Script>
        <![CDATA[
            import flash.net.navigateToURL;
           
            private function submit():void
            {
                var obj:SharedObject=SharedObject.getLocal("user","/");
               
                obj.data.username=txtName.text;
                obj.data.password=txtPassword.text;
                obj.flush();
               
                navigateToURL(new URLRequest("Recieve.html"));
            }
        ]]>
    </mx:Script>
   
    <mx:TextInput id="txtName" x="197" y="95"/>
    <mx:TextInput id="txtPassword" x="197" y="151"/>
    <mx:Button x="238" y="216" label="Button" click="submit()"/>
   
</mx:Application>


接收页(Recieve.mxml):
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">

    <mx:Script>
        <![CDATA[
            private function init():void
            {
                var objRec:SharedObject=SharedObject.getLocal("user","/");
               
                lblName.text=objRec.data.username;
                lblPassword.text=objRec.data.password;
            }
        ]]>
    </mx:Script>

    <mx:Canvas x="229" y="43" width="200" height="200" backgroundColor="#FFFFFF">
        <mx:Label id="lblName" x="10" y="10" text="Label"/>
        <mx:Label id="lblPassword" x="10" y="36" text="Label"/>
    </mx:Canvas>
   
</mx:Application> 

你可能感兴趣的:(html,xml,.net,Flex,Flash)