在将 SharedObject 添加到 .AS 文件时遇到问题,我正在尝试将用户名添加到红色 5 中的 .flv 文件中,例如“username_myfile”我不确定我是否添加了将名称保存在正确部分的代码班级。是否有将 SharedObject 添加到 .AS 文件的正确方法?
- 添加:
import flash.net.SharedObject;
package app
{
import flash.display.BitmapData;
import flash.display.Stage;
import flash.external.ExternalInterface;
**import flash.net.SharedObject;**
public class DataHolder
{
private static var dataHolder:DataHolder;
public var savedstuff:SharedObject = SharedObject.getLocal("myStuff2","/");
if (savedstuff.size > 0)
{
public var username = savedstuff.data.username;
}
public var filename:String = (String(username) + "_myfile");
public var rtmpPath:String = "rtmp://numbershere.compute-1.amazonaws.com/oflaDemo/";
public var recorder:Recorder;
public var navigation:Navigation;
public var cameraFPS:Number = 30;
public var cameraWidth:Number = 640;
public var cameraHeight:Number = 480;
public var cameraQuality:Number = 88;// camera quality
public var timelimit:Number = 25;// limit count of seconds
public var stage:Stage;
public function DataHolder()
{
if (dataHolder)
{
throw new Error("Only one DataHolder instance should be instantiated");
}
}
public static function getInstance():DataHolder
{
if (dataHolder == null)
{
dataHolder = new DataHolder();
}
return dataHolder;
}
}
}