7 Replies Latest reply on Feb 4, 2010 6:22 PM by Harry Kunz

    I cannot "capture" the fullScreen display state

    Guermantes

      Hi,

      When trying to get my head around another problem I have with altering content depending on whether the displayState is normal or fullScreen, I tried to set up a feedback/debug box that would send me messages about the displayState. I created a textbox with dynamic text and gave it a variable name, and then wrote a little AS2 tidbit as follows:

       

      if (Stage["displayState"]="normal") {
          textbox = ("you're in normal mode");
      } else {
          textbox = ("you're in fullscreen mode");
      }

       

      When I start the movie and am in normal mode then I get the correct message but when I hit a button to toggle true fullscreen on then the normal message stays on screen.

       

      Obviously I am new to all this, what am I doing wrong?

       

      Thanks!

        • 1. Re: I cannot "capture" the fullScreen display state
          Harry Kunz Level 4

          Where did you place the code to turn full screen on? Why not place the text assignment there?

           

          mcMyButton.onPress = function()

          {

             Stage["displayState"] = "fullScreen";

             myTextField.text = "you're in fullscreen mode";

          }

           

          By the way textbox should be textbox.text

          • 2. Re: I cannot "capture" the fullScreen display state
            Guermantes Level 1

            Hi, thanks for your answer. It cleared away some clouds for me.

             

            I think my problem is that I don't understand how actionscript is parsed by the Flashplayer engine. I had placed my if-statement at the bottom of all AS-code, on its own - and as my Flash movie only has one frame and that is the location of all the AS - I thought that the movie would be looping this frame over and over and thus the AS would be parsed over and over. Hence, putting the if-statement at the bottom I thought it would be continually evaluated and sending the correct value to my textbox depending on the displayState.

             

            But when I put the if-statement inside the functions to go/exit fullscreen, then it works, but of course since I intended it as a feedback mechanism it is then redundant since I can see on screen that fullscreen is activiated/disactivated.

             

            1) Perhaps I should focus my question on the parsing issue: I thought that since it is a slideshow gallery that keeps playing and changing images then the script is parsed over and over again? But perhaps the script is only parsed once, and it is its instructions that have told the player to keep changing images? Then I can see why putting the if statement at the bottom did not produce the result I wanted.

             

            2) If I want to change the characteristics of my movie to behave in one way in normal fixed width display and behave differently when it is displaying in fullscreen, should I put all code relating to how it is supposed to display when in fullscreen inside the function that tells it to go fullscreen? And then put all code reverting those changes inside the function that exits fullscreen? (You see the advanced state of my actionscript knowledge!!)

             

            /G

             

            PS. 'textbox.txt' does not produce anything on screen, 'textbox' does. 'textbox' is the variable name of my dynamic text field.

            • 3. Re: I cannot "capture" the fullScreen display state
              Harry Kunz Level 4

              it's ".text" property not ".txt". Hmm you say it's a textfield variable and it works without putting .text??? Not supposed to work, that's totally weird. But anyway it works for you i guess. Flash executes script of one frame as it's playhead enters the frame. But if there is only 1 frame then it won't "move" to itself again hence it won't execute the code again. If you want it to periodically execute a script with a speed of 1/FRAMERATE seconds or the time it jumps from frame to frame then you can use the onEnterFrame function like this:

               

              this.onEnterFrame = function()

              {

                 trace("Execute this statement periodically");

              }

               

              For the code execution, place it inside the function after the statement that instructs flash player to get into fullscreen mode.

              • 4. Re: I cannot "capture" the fullScreen display state
                Guermantes Level 1

                Thanks for your reply.

                 

                Just as a follow-up regarding the textbox.

                 

                This does not produce any text on the screen:

                 

                function goFullScreen():Void {
                    Stage["displayState"] = "fullScreen";
                    if (Stage["displayState"]="fullScreen") {
                        textbox.text = ("you're in fullscreen mode");
                    }
                }

                 

                whereas this does produce the desired text on screen:

                 

                function goFullScreen():Void {
                     Stage["displayState"] = "fullScreen";
                     if (Stage["displayState"]="fullScreen") {
                         textbox = ("you're in fullscreen mode");
                     }
                }

                 

                I don't have the AS-knowledge to say whether that is wierd or not.

                • 5. Re: I cannot "capture" the fullScreen display state
                  Harry Kunz Level 4

                  You're welcome. That would mean textbox is not of type "TextField". Coz i tried not using ".text" and it doesn't work for me. I'm curious as to how you made it work. Hmmmm.. Can you post the file so i can see?

                  • 6. Re: I cannot "capture" the fullScreen display state
                    Guermantes Level 1

                    here it is, the relevant button functions are at the bottom...

                    • 7. Re: I cannot "capture" the fullScreen display state
                      Harry Kunz Level 4

                      Ahh. Okay i now see why it works. You assigned the variable field. Most programmers don't use that. It's better to use the Instance Name. Thanks for showing me!