【问题标题】:AS3 - use of stage in an external swfAS3 - 在外部 swf 中使用阶段
【发布时间】:2013-09-13 19:04:54
【问题描述】:

我购买了一个定制的无铬 youtube 视频播放器。最初的预期用途是嵌入到 HTML 页面中......但是根据我的需要,它必须作为外部 swf 加载到另一个容器 swf 中。

问题是这个播放器的代码中多次引用了“舞台”。

例如要进入全屏模式,就使用这个:

function fsClick(e:MouseEvent) {
    if(controls.fsBtn.currentFrame == 10) {
        stage.displayState = StageDisplayState.FULL_SCREEN;
        controls.fsBtn.gotoAndStop("backToNormalOver");
    }
    else {
        stage.displayState = StageDisplayState.NORMAL;
        controls.fsBtn.gotoAndStop("goFsOver");
    }
}

另一个例子:

//stage resize event
stage.addEventListener(Event.RESIZE, onStageResize);

function onStageResize(e:Event):void{
    stage_width = stage.stageWidth;
    stage_height = stage.stageHeight;
    player.setSize(stage_width,stage_height);

    controls.x = (stage_width - controls.width)/2;
    controls.y = stage_height - 40;

    stageOver(null);

    if (stage.displayState == StageDisplayState.NORMAL) {
        controls.fsBtn.gotoAndStop("goFs");
    }

    topBar.titleBar.width = stage_width;
    topBar.theTime.x = stage_width - topBar.theTime.width -10;
    topBar.theTitle.width = stage_width - 180;
}

现在,正如您已经猜到的那样,问题是“阶段”在此上下文中不再相关,因为它指的是容器的阶段,而不是这个 swf 的阶段。

我尝试制作与舞台尺寸相同的movie_clip,并将其命名为“stage_mc”,并将所有引用从“stage”切换到“stage_mc”......这样的作品,但显然不是:

stage.displayState = StageDisplayState.FULL_SCREEN;

有没有办法解决这个问题?有没有办法识别外部影片剪辑中的舞台?

【问题讨论】:

    标签: actionscript-3 flash stage


    【解决方案1】:

    不,只有一个阶段。在您的情况下,它将代表父 SWF 的阶段。

    但要解决您的全屏问题,您仍然可以将舞台设置为全屏模式,然后缩放 stage_mc 以填充父 SWF。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-07-30
      • 1970-01-01
      • 1970-01-01
      • 2011-10-20
      相关资源
      最近更新 更多