8 Replies Latest reply on Sep 3, 2009 5:32 PM by DeyBwah

    Newbie Question (Coming back from fullScreen videoPlayer function = lost component?)

    DeyBwah Level 1

      Hi everyone,

       

      I'm running into an issue with my video player's backFromFullscreen function.

       

      Summary:

      The video player application has 2 components - videoPlayer and sharingBookmarks.

       

      Here's how it functions...

      The videoPlayer is loaded to displayList via addChild, when the video reaches the end, it dispatches an event that hides the videoPlayer (visible=false) and addChilds the sharingBookmarks.

      Everything works squeaky clean, unless during the video playback, I goToFullscreen then backFromFullscreen... then when the video completes, hideVideo function works and my Alerts tell me that the sharingBookmarks exists on the displayList, but it isn't visible..

       

      Things I've tried:

      1. I've tested to make sure that the sharingBookmarks has a higher index than the videoPlayer with the getChildAt(0) and getChildAt(1) which confirms the sharingBookmarks is in front.
      2. I've tested to make sure all the functions are indeed firing. ie. hideVideo, addChild(sharingBookmarks),

       

       

      Conclusion:

      There has to be something in the goToFullscreen and/or backFromFullscreen function that I don't know about.. especially because that code was created by someone else and I don't understand a lot of the code in there. I'm hoping that someone can help me understand what those functions are doing exactly and/or explain the issue. (hopefully it is simple and I'm just not seeing it)

       

      The code:

       

      private function goToFullscreen():void {

        trace('goToFullscreen (width x height):'+this.width+'x'+this.height);

        oldWidth = this.width;

        oldHeight = this.height;

         

        systemManager.stage.displayState = StageDisplayState.FULL_SCREEN; // What is this code doing?

         

        this.width = systemManager.screen.width;

        this.height = systemManager.screen.height;

         

        videoDisplay.width = this.width;

        videoDisplay.height = this.height-BAR_HEIGHT;

         

        starterImageCanvas.width = this.width;

        starterImageCanvas.height = this.height-BAR_HEIGHT;

         

        starterImage.width = this.width;

        starterImage.height = this.height-BAR_HEIGHT;

         

        thisParentRef = this.parent; // Not sure what this and the next 2 lines of code are doing...

       

       

        var thisRef:DisplayObject = thisParentRef.removeChild(this); // This line...

        Application.application.addChildAt(thisRef, 0); // And this line?

       

        Application.application.width = systemManager.screen.width;

        Application.application.height = systemManager.screen.height;

      }

       

       

      private function backFromFullscreen():void {

        trace('backFromFullscreen (width x height):'+oldWidth+'x'+oldHeight);

        checkDimension();

       

        systemManager.stage.displayState = StageDisplayState.NORMAL; // What is this code do?

         

        fullScreenButton.selected = false;

       

        thisParentRef.addChildAt( this.parent.removeChild(this), 0 ); // Is this just adding the videoPlayer where the fullScreen was removed?

       

        this.width = oldWidth;

        this.height = oldHeight;

         

        videoDisplay.width = this.width;

        videoDisplay.height = this.height-BAR_HEIGHT;

         

        starterImageCanvas.width = this.width;

        starterImageCanvas.height = this.height-BAR_HEIGHT;

         

        starterImage.width = this.width;

        starterImage.height = this.height-BAR_HEIGHT;    

      }

       

      Thanks so much!

      DK