我正在尝试让投影机文件在启动时全屏运行,而无需点击任何内容。我的主要类继承自MovieClip,所以据我所知,我可以访问舞台...是的,是的:)
package
{
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.display.StageDisplayState;
import flash.display.Stage;
import flash.ui.Mouse;
public class PhoneDemo extends MovieClip
{
Stage.displayState=StageDisplayState.FULL_SCREEN;
//declare variables
public var scoreArray:Array = [null];
这根本不起作用,我无法进入舞台,我得到错误1120.我确信我之前已经进入舞台,我真的很困惑。
答案 0 :(得分:4)
stage
是DisplayObject的属性; Stage
是班级。
尝试以小写形式访问它。此外,如果您在构造函数中访问该阶段,它将不会被分配。
答案 1 :(得分:3)
public class PhoneDemo extends MovieClip{
addEventListener(Event.ADDED_TO_STAGE, addedToStage);
// you cannot access the stage here, because the stage relation has not been established
}
internal function addedToStage(e:Event){
removeEventListener(Event.ADDED_TO_STAGE, addedToStage);
// you can access the stage here
}