Mike wrote:

>I'm opening a MIAW from my projector. I have a close routine (x
>in the upper right) with the following code
>
>on mouseUp
>   tell the stage to closeMiaw
>end
>
>and in my main movie...
>
>on closeMiaw
>   if ilk(gMyMiaw) <> #window then exit  -- MIAW is not opened so
>exit
>   close gMyMiaw                         -- close MIAW
>   forget gMyMiaw                        -- forget MIAW so you can
>edit the MIAW when projector is still running
>   --  set the visible of the stage = TRUE   -- make the stage
>visible again
>end closeMiaw
>
>my problem is if I try to close the MIAW before it has actually
>started I get the following error:
snip

I don't understand what you mean by "try to close the MIAW before it 
has actually started", but anyway: It does not help to "tell the 
stage" to forget the miaw, if the event that forgets the miaw 
originates from the miaw itself. So your code above wont prevent the 
dreaded miaw-close-crash. You need to somehow defer the process of 
forgetting the miaw to an event which comes from the stage itself.

Excerpts from earlier direct-l mail follows:

In D8, "timeOutObjects" seem perfect for the purpose.
Below an example where a mouseDown inside the MIAW, transfers the 
process of forgetting the MIAW to the stage, without the need for any 
implementation in the stage itself:

Both of the scripts below are to be implemented in the miaw, however 
they do the forgetting from an event from the stage.

It works because each movie has its own timeOutList.

----<score script: "forgetButton">----
on mouseUp me
   script("miawForgetter").new()
end
----</score script: "forgetButton">----

----<parent script: miawForgetter>----
property pWindow

on new me
   pWindow = the activeWindow
   pWindow.close()
   tell the stage
     timeOut(me.string).new(1, #mForget , me)
   end tell
end

on mForget me, aTimer
   aTimer.forget()
   theWindow = pWindow
   pWindow = VOID
   theWindow.forget()
end
----</parent script: miawForgetter>----

Only tested on Mac, but see if this works well on Winthell.
If you do not have D8, I'm pretty sure someone has a more classic 
"looping flagWatcher" approach handy.
Cheers, Jakob


[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/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!]

Reply via email to