4 Replies Latest reply on Apr 21, 2011 5:14 PM by onefiftymph

    Movie in a window basic setup question

    onefiftymph Level 1

      Learning MIAW and dont know how to set up what I want.

       

      I have 2 looping mpgs, each in its own MIAW.dir file (MIAW1, MIAW2). In my main movie (main.dir), I want to click a button ("movies") to call up and play the first MIAW, click it again to swap it to the 2nd, click it a third time to close the MIAW and delete it from memory, and then repeat. Is this possible?

       

      The MIAW needs to play continuously in front of the stage when I click from marker to marker in main.dir. using navigation buttons, until i close the MIAW.

       

      Got the code to open and play the MIAW, but not to swap it to the second and to close on clicks, or to keep it in front when click nav buttons on the stage.

       

      Probably didnt explain this so clearly..Help appreciated.

        • 1. Re: Movie in a window basic setup question
          Sean_Wilson Adobe Community Professional

          So you have your first MIAW playing successfully. It has a window name (the name you gave it when you created the window object). You can test for the existence of a window with this name using the

          windowPresent("windowName")

          function. You can also ask the MIAW which Director file it references. I would approach your question something like the following (based on our previous interaction)

          on mouseUp me
            --
          does a window object already exist?
            if _player.windowPresent(
          "MPG") then
              -- it does, so is it playing "MIAW_1" or "MIAW_2"?
              tWindow = window("MPG") -- store a reference to this window to save typing
              if tWindow.filename = "MIAW_1" then
                -- it's playing the first MIAW, have it play the second one
                tWindow.filename = "MIAW_2"
                -- move it to the front (or make it a #tool window so that it's always there...)
                tWindow.moveToFront()
              else
                -- since there are only 2 Director files for it to be playing
                -- it must be playing the second file, so it's time to close and forget the window
                tWindow.close()
                tWindow.forget()
              end if
            else
              -- create a new window object and give it a name
              tWindow = window().new ("MPG")
              -- point it to an existing Director file
              tWindow.filename = "MIAW_1" -- no .dir extension required
              -- decide where to place it on screen
              tWindow.rect = rect(0, 0, 200, 300)
              -- open it
              tWindow.open()
              -- if necessary:
             
          tWindow.moveToFront()
            end if
          end

           

          You could also make do with a single Director file for your MIAW and swap the filename of the member of the sprite that displays video (details depend on what #type of member you're using to play video), but you'd need to resize the window object (change its #rect) - and possibly the sprite's #rect - when you do so.

          1 person found this helpful
          • 2. Re: Movie in a window basic setup question
            onefiftymph Level 1

            Thanks Sean

             

            Hmmm, right off...Director doesn't like this:

             

             if _player.windowPresent("MPG") then

             

             

            Script error: Variable used before assigned a value

            • 3. Re: Movie in a window basic setup question
              CAnuszczyk

              Sure your window is not set to Javascript instead of Lingo? - just a shot...

              Otherwise, post your script

              • 4. Re: Movie in a window basic setup question
                onefiftymph Level 1

                It's Lingo, copied from Seans note above.

                 

                Today I'm getting something different. For hours yesterday before I posted the reply, I tried the above Lingo over and over - getting the same error every time. Went back to what I had working, then re-pasted it, same thing. Tried taking pieces out, starting from scratch with new movies, over and over the same thing. Re-started Dir. numerous times, re-booted the computer, finally, I re-installed Director... but nothing changed.

                 

                Then...today I'm not getting the error. Just getting what I had before - 1st click brings up MIAW_1, 2nd click closes/forgets it, not swapping in 2nd movie. Maybe Director 11 is playing games with me...I just don't have the $300 to upgrade to 11.5 right now...

                 

                There are 4 scripts in my test movie (main.dir):

                - go next  on the next button

                - go previous on the previous button

                - go to the frame at 3 separate marker positions

                - the MIAW script above on the "movie" button

                 

                There are 2 dir. files in the same folder as the main movie : MIAW_1 and MIAW_2

                 

                Think I must be real close with that nice script...but something else is wrong. Very much appreciate efforts to help. Thanks.

                 

                 

                 

                 

                 

                Dir. 11, Mac os10.5.8