您需要获取有关 OOP 的更多信息。它是如何工作的,那么理解概念会更容易。
现在简单解释一下:我们有ClassA、ClassB和ClassC:
ClassA
{
var value:ClassB;
public function ClassA ()
{
// each variable needs to initialize unless it is the ClassC, see below
// Only after that you will be able to reach the public properties
// of the class.
value = new ClassB();
value.calculate();
}
}
ClassB
{
var value:Number;
public function ClassB ()
{
}
public function calculate():void
{
// these must be statis
ClassC.sum(150, 450);
}
}
ClassC
{
// if the function is static, then you can call it without initializing
// the class
static public function sum(value1:Number, value2:Number):Number
{
return value1 + value2;
}
}