3 Replies Latest reply on Apr 30, 2008 2:32 AM by rob_100

    Miaw in dir mx 2004

    rob_100
      in director mx 04 i want to display a miaw and make this window close itself once the video in the miaw is finished playing. Can i do this by adding some script to the mouseup i made that opens the miaw? (see code example) all i need is to get it to close itself, i dont want the user to have to click another button to close and remove and miaw from memory manually...
        • 1. Re: Miaw in dir mx 2004
          UdoGre Level 1
          Hi Rob,

          it's not possible the way you want. When you read the dozens of threads you find by searching for MIAW, you'll realize that a MIAW cannot close itself. When your MIAW is done, make it set a global flag, and check for that flag in your stage movie.There you can then close and forget your MIAW.

          HTH,

          Udo
          • 2. Re: Miaw in dir mx 2004
            Level 7
            Yes, this can be done, but not (easily) by adding code to the handler
            that opens the window. Instead, place the following scripts in the MIAW
            file (home.dir).
            Before that though, a couple of points about the code you posted: once
            you've set a window's rect and opened it, you don't need to make it
            visible. And you should drop the extension from the filename - it's not
            required, and if you protect or compress the file to dxr or dcr your
            code will break. And you should provide a path to the file too:
            --
            on mouseUp me
            w = window().new ("miaw")
            w.fileName = "@/home"
            w.rect = rect(500, 0, 1000, 768)
            w.open()
            end


            In home.dir, add the following, as a #score script, to the sprite that
            plays the video. I'll assume it's a QuickTime file it plays - if not, be
            specific:
            --
            property spriteNum
            property my
            property myDuration

            on beginSprite me
            my = sprite(spriteNum)
            myDuration = my.member.duration
            end

            on exitFrame me
            if (my.movieTime >= myDuration) then _player.activeWindow.close()
            end
            --

            Now add the following handler in a #movie script:
            --
            on closeWindow
            script("window.closer.class").new(_player.activeWindow)
            end
            --

            And finally create a #parent script, name it "window.closer.class"
            (without quotes) and add the following to it:
            -- window.closer.class
            property pWindow

            on new me, aWindow
            pWindow = aWindow
            pWindow.forget()
            t = _player.windowList[1].movie.timeOut().new(string(me), -1,
            #mClose, me)
            end

            on mClose me, aTimer
            pWindow = VOID
            aTimer.forget()
            end
            --
            • 3. Re: Miaw in dir mx 2004
              rob_100 Level 1
              thanks sean!! that works perfectly!!
              does exactly what i needed!