引用类的正确方法是什么,在本例中是从同一个包引用的。下面的代码显示了类“Two”试图跟踪类“One”中变量的值。没有成功。跟踪返回未定义。
//Class One
package
{
import flash.display.Sprite;
public class One extends Sprite
{
public var myString:String = "My String";
public function One()
{
new Two();
}
}
}
//Class TWO
package
{
public class Two
{
private var oneClass:Class = One; // <- is that right?
public function Two()
{
trace(oneClass.myString);
}
}
}