14 Replies Latest reply on Jul 5, 2007 5:41 PM by Newsgroup_User

    closing a miaw

    maalhotra Level 1
      hw can you close a MIAW if you are using a custom button.
        • 1. Re: closing a miaw
          maalhotra Level 1
          i have treid this

          window("windowName").forget()

          My code

          window("MIAW").forget()

          but i get script error

          • 2. Re: closing a miaw
            maalhotra Level 1
            i have treid this

            window("windowName").forget()

            My code

            window("MIAW").forget()

            but i get script error
            • 3. Re: closing a miaw
              Level 7
              In versions before 10, you need to close a MIAW from the stage window.
              In 10, you can close a MIAW from the MIAW itself. In either case the
              button's function would look something like this:

              on mouseUp me
              window("windowName").close()
              end

              You can also refer to the window by its number in the windowList.

              If you are not going to be using the window again, be sure to "forget"
              the window also.
              • 4. Re: closing a miaw
                maalhotra Level 1
                quote:

                Originally posted by: Newsgroup User
                In versions before 10, you need to close a MIAW from the stage window.
                In 10, you can close a MIAW from the MIAW itself. In either case the
                button's function would look something like this:



                You can also refer to the window by its number in the windowList.

                If you are not going to be using the window again, be sure to "forget" on mouseUp me
                window("windowName").close()
                end
                the window also.



                Will this work:

                on mouseUp me
                window("windowName").forget()
                end
                • 5. Re: closing a miaw
                  maalhotra Level 1
                  say i want a 10 sec frame to be displayed just before it closes, can that be done?

                  ive treid

                  on exitFrame me
                  window("windowName").forget()
                  end

                  but get script error

                  and

                  on exitFrame me
                  halt
                  end

                  but it just stays, not closing
                  • 6. Re: closing a miaw
                    Level 7
                    Use the actual name of your window.
                    • 7. Re: closing a miaw
                      Level 7
                      Hi,

                      Firstly, is the 'custom button' on the main stage, or on your new MIAW?

                      1) On main stage:

                      To open a new MIAW I use something like:

                      ...as a movie script...
                      -----------------------------------------
                      global myWindow

                      on openMIAW miawFilename, miawTitle
                      myWindow = window().new(miawFilename)
                      myWindow.titlebarOptions.visible = true
                      myWindow.title = miawTitle
                      myWindow.type = #document
                      myWindow.resizable = false
                      myWindow.titlebarOptions.maximizebox = false
                      myWindow.open()
                      end
                      -----------------------------------------

                      then use something like this to open it:

                      openMIAW ("c:\newmiaw.dir","my new miaw")


                      The window name is 'myWindow' so use this to forget it add this to the movie
                      script....

                      on forgetMIAW
                      forget myWindow
                      end

                      then simply use forgetMIAW when you need to close the MIAW.




                      2) custom button in the actual MIAW

                      Use the script above to open the miaw.
                      Also include the forgetMIAW script (it needs to be a script for the main
                      stage as above, not in the miaw)

                      On your custom button on the new miaw, add a behavior...

                      on mouseUp
                      tell the stage
                      forgetMIAW
                      end tell
                      end



                      This is not a definative way of doing it - just the way I do it.


                      Hope it helps


                      Tim.



                      "maalhotra" <webforumsuser@macromedia.com> wrote in message
                      news:f6dv92$3ld$1@forums.macromedia.com...
                      > hw can you close a MIAW if you are using a custom button.


                      • 8. Re: closing a miaw
                        maalhotra Level 1
                        quote:

                        Originally posted by: Newsgroup User
                        Use the actual name of your window.



                        on exitFrame me
                        window("mypage").forget()
                        end
                        • 9. Re: closing a miaw
                          maalhotra Level 1
                          i mangaed to get the last frame display for 10 secs but it dont go away and close.

                          i have this on the last frame

                          on exitFrame me
                          halt
                          end

                          what needs to change to close it

                          ive tried

                          on exitFrame me
                          window("mypage").forget()
                          end

                          but i get a script error, object expected
                          • 10. Re: closing a miaw
                            Level 7
                            That script error usually means that the reference for the window is out
                            of scope. This means that you opened the window from one function at one
                            location in your movie, say a behavior attached to a sprite, for
                            instance, and then you tried to close the window from a different
                            location in the movie.

                            If this is the case then associate the window to a global variable.

                            The example that Tim Dixon shows is good. Remember to declare the global
                            variable again at the close function if that function isn't in the same
                            movie script or behavior window.
                            • 11. Re: closing a miaw
                              maalhotra Level 1
                              closing it works fine but i want to have something before it closes, a screen to display before it closes. how do i achvie this.
                              • 12. Re: closing a miaw
                                Level 7
                                One simple solution is to move to a new frame when the user hits the
                                close button. Then show what you want, hold the user there for however
                                long you want, and then call the close() command.
                                • 13. Re: closing a miaw
                                  maalhotra Level 1
                                  quote:

                                  Originally posted by: Newsgroup User
                                  One simple solution is to move to a new frame when the user hits the
                                  close button. Then show what you want, hold the user there for however
                                  long you want, and then call the close() command.



                                  that is waht i have done but it doesnt close, instead it stays on the frame.
                                  • 14. Re: closing a miaw
                                    Level 7
                                    Can you show the code that you're using?