AS3 StageVideo > controlling depth of multiple stage video instances

∥☆過路亽.° 提交于 2019-12-12 04:48:40

问题


http://www.adobe.com/devnet/flashplayer/articles/stage_video.html

According to the documentation the stageVideo object exposes a depth property which allows you to set the z depth.

But am confused on how to implement. There is a read only vector object

stage.stageVideos[0];

but how exactly do you populate this vector with more than one StageVideo object? Nowhere in the documentation does it explain this.


回答1:


The stage.stageVideos array is pre-populated with the amount of stage video objects the system supports. So you don't have to do anything there. That number can change though based off app size and other things, so it's important to listen for the stage video availability events and react accordingly.

To change the z-order, you use the depth property of a StageVideo instance:

var stgVideo1:StageVideo = stage.stageVideos[0];
stgVideo.depth = 2;

//if the system supports more than 1, lets grab a reference to another stage video
if(stage.stageVideos.length > 1){
    var stgVideo2:StageVideo = stage.stageVideos[1];
    stgVideo2.depth = 1;
}

This will make stgVideo2 behind the first one. All things being equal (same depth value, or none specified) the depth will be the same order as the stage.stageVideos array.

For more information, read the documentation



来源:https://stackoverflow.com/questions/29659660/as3-stagevideo-controlling-depth-of-multiple-stage-video-instances

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!