0
votes

I've purchased a custom chromeless youtube video player. The original intended use of this is to be embedded into an HTML page... however for my needs, it must be loaded as an external swf into another container swf.

The problem is that "stage" is referenced several times throughout the code of this player.

For instance to go to full screen mode, this is used:

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");
    }
}

another example:

//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;
}

Now, the problem as you have already guessed, is that "stage" is no longer relevant in this context as it refers to the container's stage and not this swf's stage.

I tried making a movie_clip with the same dimensions as the stage and naming it "stage_mc" and switching all references from "stage" to "stage_mc"... and that sort of works, but obviously not for:

stage.displayState = StageDisplayState.FULL_SCREEN;

Is there any way around this? Is there a way to recognize the stage in an external movieclip?

1

1 Answers

0
votes

No, there's only one stage. In your case it will represent the parent SWF's stage.

But to get around your fullscreen problem you could still set the stage to fullscreen mode and then scale stage_mc to fill the parent SWF.