Sure, I'm just showing the fundamentals. In fact, if you had multiple
MIAWs you might add them to a kill list that would normally be empty, and
so you might be processing them like:
on processWindowKills
-- Repeatedly called in the main movie on a regular basis
global gWindowKillList
if (not listP(gWindowKillList)) then
return
end if
numToKill =count(gWindowKillList)
if (not numToKill) then
return
end if
repeat with x=1 to numToKill
whichWindow =gWindowKillList[x]
forget whichWindow
end repeat
gWindowKillList =[]
end
on killThisWindow
-- Called from the MIAW
global gWindowKillList
if (not listP(gWindowKillList)) then
gWindowKillList =[]
end if
add(gWindowKillList, the activeWindow)
end
This would handle a busier app with multiple windows that might be queued
up to be killed, so you don't miss any. There are endless variations -
this is not the only way to do it. The important thing, though, is the
basic concept, that the forget command has to ultimately be done in the
root context of the stage (main movie) and not the window itself.
I first saw this bug some years ago, and it was most insidious because it
didn't show in authoring mode, and only showed up in projectors (where
there is limited debugging), and only on Windows. This is because the
Windows windowing code is different than the Mac, of course, and differs
runtime vs. authoring. Another good reason to occasionally test from a
projector and not just authoring mode.
- Tab
At 04:29 AM 7/30/02, Mayuresh wrote:
>Hi
>
>All the methods suggested my other people will do the job perfectly.
>However I would make a slight change in Tab Julius's code.
>
>on mouseUp me
>--for the close button on your MIAW
>tell the stage
> closeMiaw()
>end tell
>end
>
>Then in the closeMiaw handler which is on your stage, have the code to
>close and forget your Miaw.
>You can of course pass your window reference globals to and fro to make
>sure you're closing the right Miaw.
>
>Another way would be to use your projector exit handler to go through the
>'windowlist' and forget all instances of any MIAW's.
>So initially when you actually close a MIAW, you don't 'forget' it, simply
>just 'close' it.
>---
> repeat with i = 1 to (the windowlist).count
> forget the windowList[i]
> end repeat
>---
>Though not recommended, it works well to take care of the bug which kills
>all sounds on the stage when you forget a MIAW.
>
>HTH.
>
>Mayuresh
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/lingo-l.cgi To post messages to the list, email
[EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for
learning and helping with programming Lingo. Thanks!]