我正在尝试保存一些设置,为此,我试图列出一个类的属性,但得到0。
package
{
public class Definitions extends Object
{
var _userDevicePhone: Boolean = true;
var _userDeviceTablette: Boolean = false;
var _userDeviceDesktop: Boolean = false;
var _userDeviceLock: Boolean = false;
var stages: Object;
var objectTransform: Object;
var editorGrid: Object;
var navigator: Object;
public function Definitions()
{}
function Init(): void
{
trace("initialising definitions");
stages = Main.stages;
objectTransform = Main.objectTransform;
editorGrid = Main.editorGrid;
navigator = Main.navigator;
}
}
}
package
{
public class UserSettings
{
var definitions: Object;
public function UserSettings()
{}
function Init(): void
{
definitions = Main.definitions;
}
function Save(): void
{
var cnt: int;
for (var s: String in definitions)
{
cnt++;
//var value: Object = definitions[i];
//trace(i + " = " + value);
}
trace(cnt);
}
}
}
我在这里剪掉了大部分代码,但是我认为剩下的足以理解我的问题了……它跟踪0。我对此很陌生,我认为一个类是一个对象,我即使是定义类上的扩展对象,也许我也不明白它的作用。请帮忙!