MIAW

From Director Online Wiki
Jump to: navigation, search

Description

The acronym MIAW stands for Movie In A Window. You can open any movie in a separate window, using the open() command.

Usage

The way windows are handled has changed in Director MX 2004. This article deals first with the syntax for Director MX and earlier. This syntax can also be used with Director MX 2004 if the scriptExecutionStyle is set to 9. See the end of the article for the Director 10 changes.

The typical life cycle of a MIAW is: *create>>open>>close>>forget

Creating

This section mostly applies to DirectorMX 2004+ In earlier versions it was not necessary to create the window before opening it (although it was possible).

To create a MIAW in DirectorMX 2004+, it is now necessary to call new()

The documentation for MIAWs in DirectorMX 2004 is lacking any mention of this important detail. Without it, you can't really get any MIAWs open.

In other words, what once was accomplished by

open window "someFilename.dir"

...must now be...

window().new("someFilename.dir").open()

If you want to grab a reference to the window when you create it, you might do the following

myMIAW = window().new("someFilename.dir")
myMIAW.open()

Alternatively, if you prefer not to create too many reference to the window, you can just use the filename to refer to it.

property wname
on beginsprite me
  wname = "whatever.dir"
  window().new(wname)
end
on endsprite me
  window(wname).close()
end

If you want to open an arbitrary movie from disk, in a window, you can do the following:

window().new("").open()

and this will throw up a file selection dialog box just as

open window ""

...did in earlier versions. The string parameter passed to new() can be whatever you like, because the file selection dialog will prompt you with "where is...". You can then select any .DIR, .DCR or .DXR file and it will open in a window. The window will then be named "". If you then want to open another arbitrarily chosen movie, before forgetting the one that's open, you'll have to use another string instead of "" - all windows must have unique names.

Macromedia Director Technote - How do I make a movie in a window? includes some downloadable files which demonstrate how to create, open, and close MIAWs.

--Brennan 06:41, 14 Sep 2005 (MDT)

Opening

Closing

Forgetting

to successfully forget a miaw you can place the following parent script in a shared castlib:

lingo parent script

--@name             MIAW_FORGET_OBJ 
--@type             par
--@author           ben@benjaminalbrecht.com. i didnt invent this, its just my version of this common solution. 
--@descr            the stage movie has to run due to the timeout technique 
--@params           optional window (default=the activeWindow)
--@xmp              to forget the activeWindow: script("MIAW_FORGET_OBJ").new() 
--                  to forget window x:         script("MIAW_FORGET_OBJ").new( window("myMiaw") ) 
--@edited           10-03-2006 Mike Blaustein cleaned up the version checking code


property win -- WINDOW



on new(me, aWin )
  --@returns        void
  --@params         optional window(default=the stage)
  --@descr          adds too to stage's timeoutlist
 
 
  if voidP( aWin ) then aWin = the activeWindow
 
 
  me.win = aWin
 
 
  tell the stage
   
     
    tStrTooName = me.string
    
    global version

    --find out the version of Director so we use the correct timeout syntax
    oldDelim=the itemDelimiter 
    the itemDelimiter="."
    
    dirVersion=version.item[1]
    the itemDelimiter=oldDelim
    if value(dirVersion)>=10 then
      -- mx04
      x = timeout().new( tStrTooName, 1, #_tooMiawForget, me )
    else
      -- 85
      x = timeout(tStrTooName).new( 1, #_tooMiawForget, me )
    end if
    
    timeout(tStrTooName).persistent = TRUE
    
  end tell
  
  
end new



on _tooMiawForget(me, aToo)
  --@returns        void
  --@params         timeout
  --@descr

  aToo.forget()
  aToo = void

  me.win.close()
  me.win.forget()
  me.win = void

end _tooMiawForget


-- the following events occur to any target objects of too's.
-- if they wouldn't eat them with corresp. handlers, these events would occur
-- multiple in the next found movie script:
-- see: [[1]]
on startMovie(me)
  nothing
end
on stopMovie(me)
  nothing
end
on prepareFrame(me)
  nothing
end 
on enterFrame(me)
  nothing
end 
on exitFrame(me)
  nothing
end 

?¢‚Ǩ¬?/lingo end?¢‚Ǩ¬?

Properties

blend

Undocumented, DIR10+, Win-only, Projector-only, etc etc, but very cool! try this at home:

on startMovie()

 (the stage).blend = 80

 tWin = window("tWin").new()
 tWin.filename = "c:\miaw.dir"
 tWin.open()
 tWin.blend = 65

end startMovie

originally posted by Tom Higgins

Methods