home *** CD-ROM | disk | FTP | other *** search
- -- RearWindow XObject Example Movie
- -- by David Jackson-Shields
- -- vers. 1.0.2 (10/11/93)
- --
- -- © 1992-94 by Macromedia, Inc. and David Jackson-Shields
- -- All Rights Reserved
- --
- -- This movie demonstrates the use of the RearWindow XObject, which requires
- -- System 6.0.5 or later.
- -- The uses of the "RearWindow XObject" are:
- -- (1) When using a Stage size smaller than your monitor screen...you
- -- can cover the Finder Desktop when running on system 7.x or later,
- -- (or when running with systems 6.0.7 or later under "Multi-Finder" mode.)
- -- Options include filling the Rear Window with:
- -- (A) a 1-bit QuickDraw pattern: white, ltGray, gray, dkGray, black
- -- (B) the Finder Desktop pattern (whether color or black & white)
- -- (C) an indexed color of the current palette
- -- (D) an RGB color (specified by Red, Green, Blue values)
- -- (E) a Director bitmapped castMember (either stretched or non-stretched)
- -- (F) a PICT file image (either stretched or non-stretched)
- -- (2) To obtain the monitor screen pixel dimensions (top, left, bottom, right)
-
- -- NOTE: The addition of an extra window even larger than your Stage will
- -- impact the memory requirements of your project. Check the "About MM"
- -- memory guage, or put the freeBytes and the freeBlock in the message
- -- window to see the impact this extra window has, and adjust your movieΓÇÖs
- -- memory management as needed. In addition, a copy of any castMember or
- -- PICT file image used in RearWindow is kept in RAM. This is so it can
- -- be redrawn in the RearWindow during update events...(like when the user
- -- opens a Desk Accessory or goes to MultiFinder and back, etc.)
-
-
- on ZZZstartMovie
-
- initRearWindow
- --coverDesktop -99
-
- end ZZZstartMovie
-
- --
-
- on ZZZstopMovie
-
- releaseRearWindow
-
- end ZZZstopMovie
-
- --
-
- on ZZZinitRearWindow
-
- global rwObj, gMaxColors, deskTopPattern, black
-
- set x = the colorDepth
-
- -- assign maximum index colors for the color depth setting:
- if x >= 8 then set gMaxColors = 255
- if x = 4 then set gMaxColors = 15
- if x = 2 then set gMaxColors = 3
- if x = 1 then set gMaxColors = 0
- if gMaxColors = 255 then
- put string( 100 ) into field "colorIndex" -- 100 works well with the stagecolor
- else
- put string( gMaxColors/2 ) into field "colorIndex"
- end if
-
- -- You must open an external library file if you do not have
- -- the "RearWindow" XCOD resource in the movie using ResEdit:
- if factory( "RearWindow" ) = 0 then
- OpenXLib "RearWindow.XObj"
- end if
-
- initGlobals
- if objectP( rwObj ) then rwObj( mDispose )
- makeObjIfNeeded
- when mouseDown then mouseHandler
- when keyDown then keyHandler
-
- end initRearWindow
-
- --
-
- on ZZZreleaseRearWindow
-
- global rwObj
- if objectP( rwObj ) then
- rwObj( mDispose )
- end if
-
- -- You must Close the Xlib if you do not have
- -- the XCOD resource installed in the movie with ResEdit:
- CloseXLib
-
- put " " into field "stage&Screen"
- put " " into field "colorIndex"
- set the mouseDownScript to EMPTY
- set the keyDownScript to EMPTY
-
- end releaseRearWindow
-
- --
-
- on ZZZinitGlobals
-
- -- these 1-bit pattern values are constantized in this example movie
- -- for use when calling the coverDesktop handler from button scripts:
- global white, ltGray, gray, dkGray, black, deskTopPattern
-
- set white = -1
- set ltGray = -2
- set Gray = -3
- set dkGray = -4
- set black = -5
-
- -- The Finder Desktop pattern is the default case. To specify the
- -- Finder Desktop, use any negative integer less than -5:
-
- set deskTopPattern = -99
-
- end initGlobals
-
- -- shows the name "Macromedia Director 3.x", "MacroMind Player 3.x", or
- -- the name of the Projector:
-
- on ZZZdisplayAppName
-
- global rwObj
- put rwObj( mGetAppName ) into returnStr
- put "The name of the current application is:" & RETURN & ¬
- QUOTE & returnStr & QUOTE into field "stage&screen"
-
- end displayAppName
-
- -- fills the RearWindow with 1-bit patterns or the DeskTop pattern:
-
- on ZZZcoverDesktop patVar
-
- global rwObj
- makeObjIfNeeded
- rwObj( mPatToWindow, patVar )
-
- end coverDesktop
-
- --
-
- on ZZZloadPICT
-
- global rwObj
- makeObjIfNeeded
- set fileName = the pathName & "Background.PICT"
- set retValue = rwObj( mPICTtoWindow, fileName, 1, -99 )
- if value( retValue ) < 0 then
- alert "System error" && retValue && "trying to load PICT file" && QUOTE & ¬
- fileName & QUOTE
- stopMovie
- exit
- end if
-
- end loadPICT
-
- --
-
- on ZZZloadCast castName
-
- global rwObj
- makeObjIfNeeded
- set myPic = the picture of cast castName
- set retValue = rwObj( mCastToWindow, myPic, 1, -99 )
- if value( retValue ) < 0 then
- alert "Error trying to load castMember" && QUOTE & castName & QUOTE
- stopMovie
- exit
- end if
-
- end loadCast
-
- --
-
- on ZZZUnCoverDesktop
-
-
- end UnCoverDesktop
-
- --
-
- on ZZZmakeObjIfNeeded
-
- global rwObj
- if not objectP( rwObj ) then
-
- -- "M" indicates multiple monitors, "S" is for single monitor configuration.
- -- ONLY use "S" if there is not enough room for multiple monitors.
- -- So first...letΓÇÖs try it with multiple-monitor configuration:
- set rwObj = RearWindow( mNew, "M" )
- if value( rwObj ) < 0 then
- alert "System error" && rwObj && ¬
- "trying to create the RearWindow object in RAM (multiple-monitor config)."
- stopMovie
- exit
- end if
- writeStageAndScreenBounds
- if the freeBlock < rwObj( mGetMemoryNeeded ) then
- -- delete the object and create it again with a single-monitor config...
- if objectP( rwObj ) then
- rwObj( mDispose )
- set rwObj = RearWindow( mNew, "S" )
- end if
-
- if value( rwObj ) < 0 then
- alert "System error" && rwObj && ¬
- "trying to create the RearWindow object in RAM (single-monitor config)."
- stopMovie
- exit
- end if
- writeStageAndScreenBounds
- end if
- end if
-
- end makeObjIfNeeded
-
- --
-
- on writeStageAndScreenBounds
-
- global rwObj
- set s = "Minimum Rect around All Screens:"
- set s = s && rwObj( mGetScreenTop ) & ", "
- set s = s && rwObj( mGetScreenLeft ) & ", "
- set s = s && rwObj( mGetScreenBottom ) & ", "
- set s = s && rwObj( mGetScreenRight ) & RETURN
- set s = s & "Stage dimensions are:"
- set s = s && the stageTop & ", "
- set s = s && the stageLeft & ", "
- set s = s && the stageBottom & ", "
- set s = s && the stageRight
- put s into field "stage&Screen"
-
- end writeStageAndScreenBounds
-
- -- this method works best with the Monitors Control Panel set to
- -- 256 colors. It also works with fewer colors. With the Control
- -- Panel set to ΓÇ£thousandsΓÇ¥ or ΓÇ£millionsΓÇ¥ of colors...the choice
- -- of color is unpredictable.
-
- on fillWithIndexColor
-
- global rwObj
- makeObjIfNeeded
- -- assigning index color:
- set patVar = value( field "colorIndex" )
- rwObj( mIndexColorToWindow, patVar )
-
- end fillWithIndexColor
-
- -- this method only works with the Monitors Control Panel set to
- -- ΓÇ£thousandsΓÇ¥ or ΓÇ£millionsΓÇ¥ of colors:
-
- on fillWithRGBColor
-
- global rwObj
- makeObjIfNeeded
- -- assigning Red, Green, and Blue values of the color:
- rwObj( mRGBColorToWindow, 10000, 25000, 65000 )
-
- end fillWithRGBColor
-
- --
-
- on mouseHandler
-
- if ( the clickOn = 19 ) OR ( the clickOn = 20 ) then
- if the clickOn = 19 then
- bumpCIndex +1
- else if the clickOn = 20 then
- bumpCIndex -1
- end if
- end if
-
- end mouseHandler
-
- --
-
- on keyHandler
-
- if the key = RETURN then
- fillWithIndexColor
- dontPassEvent
- end if
-
- end keyHandler
-
- -- a parameter of +1 increments the index, whereas
- -- a parameter of -1 decrements it:
-
- on bumpCIndex direction
-
- global rwObj, white, gMaxColors
- set cIndex = value( field "colorIndex" )
- if integerP( cIndex ) then
- set cIndex = cIndex + direction
- if ( cIndex < 0 ) OR ( cIndex > gMaxColors ) then
- exit
- else
- put string( cIndex ) into field "colorIndex"
- if cIndex then
- makeObjIfNeeded
- rwObj( mIndexColorToWindow, cIndex )
- else
- coverDesktop white
- end if
- repeat while the stillDown
- set cIndex = cIndex + direction
- if ( cIndex < 0 ) OR ( cIndex > gMaxColors ) then
- exit
- else
- put string( cIndex ) into field "colorIndex"
- if cIndex then
- makeObjIfNeeded
- rwObj( mIndexColorToWindow, cIndex )
- else
- coverDesktop white
- end if
- end if
- end repeat
- end if
- end if
-
- end decrCIndex
-
- --
-
- on wait n
-
- startTimer
- repeat while the timer < n
- end repeat
-
- end wait
-
- --
-
-