ActionScript 3 Flash AS3 SharedObject

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ActionScript 3 Flash AS3 SharedObject相关的知识,希望对你有一定的参考价值。

package
{
	import flash.display.Sprite;
	import flash.net.SharedObject;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFormat;
	
	import flash.utils.*;
	
	public class SharedObjectReader extends Sprite
	{
		//the only one shared object we will work with
		private var _sharedObj:SharedObject;
		
		public function SharedObjectReader ()
		{
		
			
			//open local shared object
			try
			{
				_sharedObj = SharedObject.getLocal("myID");
				
			}
			catch (error:Error)
			{
				trace("SharedObject Error:"+error.toString());
				return;
			}
			
			//read the values, if user had already been here, he has them already.
			trace("my ID " + _sharedObj.data.myID)
			
			
			//store the values
			_sharedObj.data.myID = 60;
			
			//saving the values
			_sharedObj.flush();
			
			//The call of close
			_sharedObj.close();
			
			
		
		}
		
	}
}

以上是关于ActionScript 3 Flash AS3 SharedObject的主要内容,如果未能解决你的问题,请参考以下文章

ActionScript 3 条件速记Flash AS3

ActionScript 3 cerrar aplicacion flash as3

ActionScript 3 AS3 flash.system.Capabilities属性

ActionScript 3 使用AS3从Flash触发Javascript

ActionScript 3 在Flash AS3中嵌入抗锯齿字体

ActionScript 3 简单的Flash AS3画廊/幻灯片