发送页(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>
<?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>