我有三个类 Main(文档类)、Container 和 Area 控件。
主类代码
package
{
import flash.display.Sprite;
import flash.events.Event;
import com.andreanaya.areacontrol.Container;
public class Main extends Container
{
private var _build : Build;
public function Main():void
{
super();
if (stage) stageHandler();
else addEventListener(Event.ADDED_TO_STAGE, stageHandler);
}
private function stageHandler(e:Event = null):void
{
trace("entry point");
removeEventListener(Event.ADDED_TO_STAGE, stageHandler);
// entry point
}
}
容器类的代码
package com.andreanaya.areacontrol
{
import flash.display.Sprite;
import flash.display.Stage;
import flash.display.DisplayObject;
import flash.system.ApplicationDomain;
public class Container extends Sprite
{
public function Container() {
super();
}
override public function get stage() : Stage {
trace("$$");
return AreaControl.stage;
}
}
}
区域控制类代码
package com.andreanaya.areacontrol
{
import flash.display.Sprite;
import flash.display.Stage;
public class AreaControl extends Sprite
{
public function AreaControl() {
super();
if(_instance)
{
throw new Error("AreaControl is already instantiated.");
}
else
{
_instance = this;
_stage = stage;
return;
}
}
private static var _instance:AreaControl;
private static var _stage:Stage;
static function get stage() : Stage {
return _stage;
}
}
}
我无法从这些课程中进入舞台,有人可以帮助我吗?