Use to close MIAW with a button. Use with the Close Box MIAW behavior.
property pMouseDown, pTitleBarSprite, pDiff
on beginSprite me
set pMouseDown = 0
set lMovieName = the movieName
repeat with w in the windowList
set lPathToWin = the filename of w
if lPathToWin contains lMovieName then
set lRectTB = the rect of sprite pTitleBarSprite
set pDiff = rect(-1 * the left of lRectTB, -1 * the top of lRectTB, the width of the sourceRect of w - the right of lRectTB, the height of the sourceRect of w - the bottom of lRectTB)
exit repeat
end if
end repeat
end
on mouseDown me
set pMouseDown = 1
end
on mouseUp me
if pMouseDown then
set lTest = 1
if pTitleBarSprite = the spriteNum of me then
if NOT the doubleClick then
set lTest = 0
end if
end if
if lTest then
set lMovieName = the movieName
repeat with w in the windowList
set lPathToWin = the filename of w
if lPathToWin contains lMovieName then
set lRectOfWin = the rect of w
set lCurrHeight = the height of lRectOfWin
set lCurrWidth = the width of lRectOfWin
if lCurrHeight = (the height of the sourceRect of w) and lCurrWidth = (the width of the sourceRect of w) then
set lRectOfWin = lRectOfWin - pDiff
set lDrawRect = the drawRect of w - rect(the left of sprite pTitleBarSprite, the top of sprite pTitleBarSprite, the left of sprite pTitleBarSprite, the top of sprite pTitleBarSprite)
else
set lRectOfWin = lRectOfWin + pDiff
set lDrawRect = rect(0, 0, the width of the sourceRect of w, the height of the sourceRect of w)
end if
set the drawRect of w = lDrawRect
set the rect of w = lRectOfWin
updatestage
exit repeat
end if
end repeat
end if
end if
set pMouseDown = 0
end
on mouseUpOutside me
set pMouseDown = 0
end
on externalWindowShadeOpen me
set lMovieName = the movieName
repeat with w in the windowList
set lPathToWin = the filename of w
if lPathToWin contains lMovieName then
set lRectOfWin = the rect of w
set lCurrHeight = the height of lRectOfWin
set lCurrWidth = the width of lRectOfWin
if lCurrHeight = (the height of the sourceRect of w) and lCurrWidth = (the width of the sourceRect of w) then
-- ONLY OPEN
else
set lRectOfWin = lRectOfWin + pDiff
set lDrawRect = rect(0, 0, the width of the sourceRect of w, the height of the sourceRect of w)
end if
set the drawRect of w = lDrawRect
set the rect of w = lRectOfWin
dontPassEvent
updatestage
exit repeat
end if
end repeat
set pMouseDown = 0
end
on getPropertyDescriptionList me
set description = [:]
addProp description,#pTitleBarSprite,[#default:1, #format:#integer,#comment:"Which sprite is the title bar:"]
return description
end