Best way to get MIAWs to self-dispose

Date: Tue, 25 Feb 1997 02:44:35 -0800
From: "Terry R. Schussler" 
Subject: Best way to get MIAWs to self-dispose
So, after some further research, here's the best way I found to handle disposing of a MIAW. This code handles all possible permutations of opening the movie in a window file to being with during authoring and runtime both on the stage and as a MIAW. It also handles it being opened using open window, from the Xtras menu or even if the user types:

  open window "s"
and then points to a movie file with a different name when "s" is NOT the actual name of the MIAW file.

Comments are appreciated!


global gMIAWObject

on startMovie
  put the activeWindow into gMIAWObject
end startMovie

on stopMovie
  closeMIAW
end stopMovie

on closeWindow
  closeMIAW
end closeWindow

on closeMIAW
  -- remove the MIAW from memory
  put string(gMIAWObject) into windowString
  put offset(QUOTE, string(windowString))+1 into startPos
  put char startPos to length(windowString)-2 of windowString into
windowNameString
  if windowPresent(windowNameString) then
    forget gMIAWObject
    set gMIAWObject = VOID
  else
    set gMIAWObject = VOID
    halt
  end if
end closeMIAW