AS3 全屏模式下的显示帧率

AS3 Display frame rate in FULL SCREEN MODE

我有问题。我必须做一个这样的程序。当用户按下按钮 1 时,它会在视频开始前开始播放带有阴影效果的视频,当他按下另一个键 (2) 以更改他正在观看的视频时,会出现阴影效果。因为我有一台没有 GPU 的计算机非常糟糕,所以我想知道在程序执行期间计算机正在使用 100% 的 CPU 功率。我看到了这个有趣的物体:

http://www.emanueleferonato.com/2011/09/01/moviemonitor-an-as3-performance-monitor-with-10-1-features/

用于检查几个参数,例如帧速率、使用的内存和其他东西。问题是,当我用鼠标单击时,应用程序进入全屏模式并且没问题,但我在屏幕的左上角看不到对象 movieMonitor。当我处于全屏模式时,我也希望看到用 movieMonitor 创建的小框。你知道我该怎么做吗?这是我的代码:

package {
import flash.display.MovieClip;
import fl.video.FLVPlayback;
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;
import fl.motion.Source;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.display.StageDisplayState;
import movieMonitor;

public class MainLaBottegav2 extends MovieClip {

    var video1: FLVPlayback = new FLVPlayback();

    var tweenUp: Tween;
    var tweenDown: Tween;
    var tweenDownVolume: Tween;


    var state:int = 0;
    public function MainLaBottegav2() {
        video1.width = 1920;
        video1.height = 1080;


        stage.addChild(video1);
        stage.addEventListener(KeyboardEvent.KEY_DOWN, onK1Down);

        tweenUp = new Tween(video1, "alpha", Regular.easeIn, 0, 1, 4, true);


        tweenUp.stop();
        tweenDown = new Tween(video1, "alpha", Regular.easeIn, 1, 0, 4, true);
        tweenDownVolume = new Tween(video1, "volume", Regular.easeIn, 1, 0, 3, true);
        tweenDown.stop();
        tweenDownVolume.stop();
        tweenDown.addEventListener(TweenEvent.MOTION_FINISH, onTweenDownEnd);
        stage.addEventListener(MouseEvent.CLICK, onMClick);
        stage.addChild(new movieMonitor());

    }
    private function onK1Down(kDown: KeyboardEvent): void {

        if (kDown.keyCode == Keyboard.NUMBER_1) {
            trace("Tween iniziata, video1");
            state = 1;
        }
        if (kDown.keyCode == Keyboard.NUMBER_2) {
            trace("Tween iniziata, video2");
            state = 2;
        }

            tweenDown.start();
            tweenDownVolume.start();
    }
    private function onTweenDownEnd(endTween1: TweenEvent): void {
        if(state == 1) {
            trace("riproduzione video1");
            video1.source = "PathToVideo1";

        }
        if(state == 2) {
            trace("riproduzione video2");
            video1.source = "pathToVideo2";
        }

        tweenUp.start();
        video1.volume = 1;
    }
    private function onMClick(mClick:MouseEvent):void {
        stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
    }
}

}

谢谢!

我找到了解决办法。我用一个处理全屏模式的简单函数添加了这个监听器(记住导入!):

import flash.events.FullScreenEvent;

stage.addEventListener(FullScreenEvent.FULL_SCREEN, fullScreenRedraw);
private function fullScreenRedraw(e:FullScreenEvent):void {
        if(e.fullScreen){
            stage.addChild(new movieMonitor());
        }
    }

有效,我总能看到movieMonitorObject!希望这对您有所帮助!再见!