AS3在FULL SCREEN MODE中显示帧速率

时间:2017-04-05 15:05:55

标签: actionscript-3 flash movieclip frame-rate

我遇到了问题。我必须做这样的程序。当用户按下按钮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;
    }
}

}

谢谢!

1 个答案:

答案 0 :(得分:0)

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

import flash.events.FullScreenEvent;

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

它有效,我总能看到movieMonitorObject!我希望这可以帮到你!见到你!