mercredi 5 avril 2017

AS3 Display frame rate in FULL SCREEN MODE

I have got a problem. I have to do a program like this. When the user press the button 1 it will start a video with a shading effect before the start of the video and a shade effect when he press' another key(2) to change the video which he's looking at. Because I've got a computer really bad without GPU I would like to know that the computer during the execution of the program is using the 100% of the CPU power. I' ve seen this interesting object:

http://ift.tt/2nK0KtS

for checking several parameters such as the frame rate the memory used and other things. The problem is that when I click with the mouse the app go in full screen mode and it's okay but I can't see the object movieMonitor on the top-left corner of the screen. I would like to see the small box created with the movieMonitor also when I'm in full screen mode. Do you have any idea on How I could do this?Here is my code:

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

}

Thank you!

Aucun commentaire:

Enregistrer un commentaire