At 13:53 07/09/2001, Ravi Garimella wrote:
>Hi All,
>
>I am playing a MPEG Video with DirectMEdia Xtra. When i call a MIAW and 
>the mouseUp script is executed, the program
>crashes. Any Help would be appreciated.

[snip window opening code]

>---MIAW Script
>on mouseUp me
>  cursor(0)
>  sprite(spriteNum).member = overState
>tell the stage to go frame "menu" of movie "nameofmovie"
>  close(the activeWindow)
>  forget(the activeWindow)
>end

This script is the most likely cause of the crashes. It's a bad idea to use 
a script from the MIAW to forget the window - even if it's telling the 
stage to do so. Director has to try to return to the script so that it can 
finish any remaining code or 'end mouseUp'  but the script has been wiped 
from memory.

The method I use is to set a global variable that the stage monitors in a 
looping frame or in the idle event. When the stage detects something in 
that global, it then forgets the window. Something like the following 
untested Lingo:

---MIAW Script
global gForgetMIAW
on mouseUp me
   cursor(0)
   sprite(spriteNum).member = overState
   tell the stage to go frame "menu" of movie "nameofmovie"
   close(the activeWindow)
   gForgetMIAW = (the activeWindow)
end

-- movie script in stage movie
global gForgetMIAW
on idle
   if NOT gForgetMIAW.voidP then
     gForgetMIAW.forget()
     gForgetMIAW = VOID
   end if
end

I've seen others suggest using a timeOut object for this purpose, too. You 
might want to search the archives for the messages containing that suggestion.


--
Mark A. Boyd
Keep-On-Learnin' :)


[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